11<?php
22
3+ declare (strict_types=1 );
4+
35/* For licensing terms, see /license.txt */
46
57use Chamilo \PluginBundle \Entity \XApi \LrsAuth ;
8+ use Symfony \Component \HttpFoundation \Request ;
69
710$ cidReset = true ;
811
912require_once __DIR__ .'/../../main/inc/global.inc.php ' ;
1013
1114api_protect_admin_script ();
1215
13- $ request = \ Symfony \ Component \ HttpFoundation \ Request::createFromGlobals ();
16+ $ request = Request::createFromGlobals ();
1417$ plugin = XApiPlugin::create ();
1518$ em = Database::getManager ();
1619
1922$ pageContent = '' ;
2023
2124/**
22- * @throws \Exception
25+ * @return FormValidator
2326 *
24- * @return \FormValidator
27+ * @throws Exception
2528 */
26- function createForm (LrsAuth $ auth = null )
29+ function createForm (? LrsAuth $ auth = null )
2730{
2831 $ pageBaseUrl = api_get_self ();
2932
@@ -67,7 +70,8 @@ function createForm(LrsAuth $auth = null)
6770 ->setEnabled (isset ($ values ['enabled ' ]))
6871 ->setCreatedAt (
6972 api_get_utc_datetime (null , false , true )
70- );
73+ )
74+ ;
7175
7276 $ em ->persist ($ auth );
7377 $ em ->flush ();
@@ -77,6 +81,7 @@ function createForm(LrsAuth $auth = null)
7781 );
7882
7983 header ('Location: ' .$ pageBaseUrl );
84+
8085 exit ;
8186 }
8287
@@ -85,7 +90,9 @@ function createForm(LrsAuth $auth = null)
8590 $ pageBaseUrl
8691 );
8792 $ pageContent = $ form ->returnForm ();
93+
8894 break ;
95+
8996 case 'edit ' :
9097 $ auth = $ em ->find (LrsAuth::class, $ request ->query ->getInt ('id ' ));
9198
@@ -104,7 +111,8 @@ function createForm(LrsAuth $auth = null)
104111 ->setEnabled (isset ($ values ['enabled ' ]))
105112 ->setCreatedAt (
106113 api_get_utc_datetime (null , false , true )
107- );
114+ )
115+ ;
108116
109117 $ em ->persist ($ auth );
110118 $ em ->flush ();
@@ -114,6 +122,7 @@ function createForm(LrsAuth $auth = null)
114122 );
115123
116124 header ('Location: ' .$ pageBaseUrl );
125+
117126 exit ;
118127 }
119128
@@ -122,7 +131,9 @@ function createForm(LrsAuth $auth = null)
122131 $ pageBaseUrl
123132 );
124133 $ pageContent = $ form ->returnForm ();
134+
125135 break ;
136+
126137 case 'delete ' :
127138 $ auth = $ em ->find (LrsAuth::class, $ request ->query ->getInt ('id ' ));
128139
@@ -138,7 +149,9 @@ function createForm(LrsAuth $auth = null)
138149 );
139150
140151 header ('Location: ' .$ pageBaseUrl );
152+
141153 exit ;
154+
142155 case 'list ' :
143156 default :
144157 $ pageActions = Display::url (
@@ -177,11 +190,12 @@ function createForm(LrsAuth $auth = null)
177190 $ table ->setCellContents ($ row , 1 , $ auth ->getPassword ());
178191 $ table ->setCellContents ($ row , 2 , $ auth ->isEnabled () ? get_lang ('Yes ' ) : get_lang ('No ' ));
179192 $ table ->setCellContents ($ row , 3 , api_convert_and_format_date ($ auth ->getCreatedAt ()));
180- $ table ->setCellContents ($ row , 4 , implode (PHP_EOL , $ actions ));
193+ $ table ->setCellContents ($ row , 4 , implode (\ PHP_EOL , $ actions ));
181194 }
182195
183196 $ pageContent = $ table ->toHtml ();
184197 }
198+
185199 break ;
186200}
187201
0 commit comments