Passed
Push — master ( d859dd...4789a2 )
by Xavier
01:53
created
src/Security/Resources/routes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,11 +4,11 @@
 block discarded – undo
4 4
 use Security\Resources\Middleware\AuthMiddleware;
5 5
 
6 6
 
7
-$app->group('', function ()  {
7
+$app->group('', function() {
8 8
     $this->get('/login', 'AuthController:login')->setName('login');
9 9
 })->add(new GuestMiddleware($container));
10 10
 
11
-$app->group('', function () {
11
+$app->group('', function() {
12 12
         $this->get('/logout', 'AuthController:logout')->setName('logout');
13 13
 })->add(new AuthMiddleware($container));
14 14
 
Please login to merge, or discard this patch.
src/Security/Resources/Middleware/AdminMiddleware.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@
 block discarded – undo
20 20
      */
21 21
     public function __invoke(Request $request, Response $response, callable $next)
22 22
     {
23
-       if (isset($_SESSION['phpCAS']['user']))  {
23
+        if (isset($_SESSION['phpCAS']['user']))  {
24 24
             if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators']))
25 25
                 return $next($request, $response);
26
-       }
26
+        }
27 27
 
28
-       $this->flash->addMessage('error', '<i class="minus circle icon"></i> You are not allowed to access to this content.');
29
-       return $response->withRedirect($this->router->pathFor('wrong-entry'));
28
+        $this->flash->addMessage('error', '<i class="minus circle icon"></i> You are not allowed to access to this content.');
29
+        return $response->withRedirect($this->router->pathFor('wrong-entry'));
30 30
     }
31 31
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function __invoke(Request $request, Response $response, callable $next)
22 22
     {
23
-       if (isset($_SESSION['phpCAS']['user']))  {
23
+       if (isset($_SESSION['phpCAS']['user'])) {
24 24
             if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators']))
25 25
                 return $next($request, $response);
26 26
        }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@
 block discarded – undo
21 21
     public function __invoke(Request $request, Response $response, callable $next)
22 22
     {
23 23
        if (isset($_SESSION['phpCAS']['user']))  {
24
-            if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators']))
25
-                return $next($request, $response);
24
+            if (in_array($_SESSION['phpCAS']['user'], $this->container['parameters']['administrators'])) {
25
+                            return $next($request, $response);
26
+            }
26 27
        }
27 28
 
28 29
        $this->flash->addMessage('error', '<i class="minus circle icon"></i> You are not allowed to access to this content.');
Please login to merge, or discard this patch.
src/Admin/Controller/AdminController.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@
 block discarded – undo
33 33
 
34 34
             $res = [];
35 35
             foreach($students as $student) {
36
-                if ($student['uid'][0] != null)
37
-                    $res += [ $student['uid'][0] => $student['displayname'][0] ];
36
+                if ($student['uid'][0] != null) {
37
+                                    $res += [ $student['uid'][0] => $student['displayname'][0] ];
38
+                }
38 39
             }
39 40
 
40 41
             return $this->json($response, $res);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@
 block discarded – undo
27 27
             $students = $this->ldap($filter, ['displayname', 'uid']);
28 28
             $res = [];
29 29
 
30
-            foreach($students as $student) {
30
+            foreach ($students as $student) {
31 31
                 if ($student['uid'][0] != null)
32
-                    $res += [ $student['uid'][0] => $student['displayname'][0] ];
32
+                    $res += [$student['uid'][0] => $student['displayname'][0]];
33 33
             }
34 34
 
35 35
             return $this->json($response, $res);
Please login to merge, or discard this patch.
src/Admin/Resources/routes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 use App\Resources\Middleware\CountryMiddleware;
4 4
 use \Security\Resources\Middleware\AdminMiddleware;
5 5
 
6
-$app->group('/{country:[a-z]{2}}', function () use ($container) {
6
+$app->group('/{country:[a-z]{2}}', function() use ($container) {
7 7
 
8
-    $this->group('/tools', function () use ($container) {
8
+    $this->group('/tools', function() use ($container) {
9 9
         $this->map(['GET', 'POST'], '/find-student', 'AdminController:findStudent')->setName('find-student');
10 10
     })->add(new AdminMiddleware($container));
11 11
 
Please login to merge, or discard this patch.
src/App/Controller/UserController.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,9 @@
 block discarded – undo
27 27
         ]);
28 28
 
29 29
         foreach (json_decode($enrollments->getBody()->getContents()) as $enrollment) {
30
-            if ($enrollment->class->title != null)
31
-                array_push($classes, $enrollment->class);
30
+            if ($enrollment->class->title != null) {
31
+                            array_push($classes, $enrollment->class);
32
+            }
32 33
         }
33 34
 
34 35
         return $this->view->render($response, 'App/user.twig',[
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@
 block discarded – undo
31 31
                 array_push($classes, $enrollment->class);
32 32
         }
33 33
 
34
-        return $this->view->render($response, 'App/user.twig',[
34
+        return $this->view->render($response, 'App/user.twig', [
35 35
             'classes' => $classes,
36 36
             'student_name' => $this->ldapFirst("uid=$id")['displayname'][0]
37
-        ] );
37
+        ]);
38 38
 
39 39
     }
40 40
 
Please login to merge, or discard this patch.
src/App/Controller/Controller.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,15 +69,15 @@
 block discarded – undo
69 69
      */
70 70
     public function createJWT()
71 71
     {
72
-        return json_decode( $this->http->request('POST', 'auth/login', [
73
-            'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' ],
72
+        return json_decode($this->http->request('POST', 'auth/login', [
73
+            'headers' => ['X-Requested-With' => 'XMLHttpRequest'],
74 74
             'json' => [
75 75
                 'username' => $this->parameters['api']['username'],
76 76
                 'password' => $this->parameters['api']['password']
77 77
             ]
78 78
         ])
79 79
             ->getBody()
80
-            ->getContents() );
80
+            ->getContents());
81 81
     }
82 82
 
83 83
 
Please login to merge, or discard this patch.
src/App/Resources/routes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 $app->get('/', 'AppController:redirectHome')->setName('wrong-entry');
6 6
 
7
-$app->group('/{country:[a-z]{2}}', function () {
7
+$app->group('/{country:[a-z]{2}}', function() {
8 8
     $this->get('', 'AppController:home')->setName('home');
9 9
     $this->get('/users/{id}', 'UserController:user')->setName('user-profile');
10 10
 })->add(new CountryMiddleware($container));
Please login to merge, or discard this patch.
src/App/Resources/Middleware/CountryMiddleware.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@
 block discarded – undo
17 17
         $country_id = $request->getAttribute('routeInfo')[2]['country'];
18 18
 
19 19
         // Useful when a client edits the URL and types a language that does not exist.
20
-        if (!$this->checkCountry($country_id))
21
-            return $response->withRedirect($this->router->pathFor('wrong-entry'));
20
+        if (!$this->checkCountry($country_id)) {
21
+                    return $response->withRedirect($this->router->pathFor('wrong-entry'));
22
+        }
22 23
 
23 24
         setcookie('country', $country_id, time() + (30 * 24 * 60 * 60)); // 30 days
24 25
 
Please login to merge, or discard this patch.
src/App/Model/User.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         return User::find($uid)->user['sourcedId'];
16 16
     }
17 17
 
18
-   /** protected $fillable = [
18
+    /** protected $fillable = [
19 19
         'username',
20 20
         'email',
21 21
         'password',
Please login to merge, or discard this patch.