Passed
Push — master ( a14240...3e537e )
by Xavier
07:17
created
public/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use Symfony\Component\Dotenv\Dotenv;
6 6
 use Symfony\Component\HttpFoundation\Request;
7 7
 
8
-require __DIR__.'/../vendor/autoload.php';
8
+require __DIR__ . '/../vendor/autoload.php';
9 9
 
10 10
 session_start();
11 11
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     if (!class_exists(Dotenv::class)) {
15 15
         throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
16 16
     }
17
-    (new Dotenv())->load(__DIR__.'/../.env');
17
+    (new Dotenv())->load(__DIR__ . '/../.env');
18 18
 }
19 19
 
20 20
 if ($_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))) {
Please login to merge, or discard this patch.
src/Kernel.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function getCacheDir()
18 18
     {
19
-        return $this->getProjectDir().'/var/cache/'.$this->environment;
19
+        return $this->getProjectDir() . '/var/cache/' . $this->environment;
20 20
     }
21 21
 
22 22
     public function getLogDir()
23 23
     {
24
-        return $this->getProjectDir().'/var/log';
24
+        return $this->getProjectDir() . '/var/log';
25 25
     }
26 26
 
27 27
     public function registerBundles()
28 28
     {
29
-        $contents = require $this->getProjectDir().'/config/bundles.php';
29
+        $contents = require $this->getProjectDir() . '/config/bundles.php';
30 30
         foreach ($contents as $class => $envs) {
31 31
             if (isset($envs['all']) || isset($envs[$this->environment])) {
32 32
                 yield new $class();
@@ -38,24 +38,24 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $container->setParameter('container.autowiring.strict_mode', true);
40 40
         $container->setParameter('container.dumper.inline_class_loader', true);
41
-        $confDir = $this->getProjectDir().'/config';
42
-        $loader->load($confDir.'/packages/*'.self::CONFIG_EXTS, 'glob');
43
-        if (is_dir($confDir.'/packages/'.$this->environment)) {
44
-            $loader->load($confDir.'/packages/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
41
+        $confDir = $this->getProjectDir() . '/config';
42
+        $loader->load($confDir . '/packages/*' . self::CONFIG_EXTS, 'glob');
43
+        if (is_dir($confDir . '/packages/' . $this->environment)) {
44
+            $loader->load($confDir . '/packages/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');
45 45
         }
46
-        $loader->load($confDir.'/services'.self::CONFIG_EXTS, 'glob');
47
-        $loader->load($confDir.'/services_'.$this->environment.self::CONFIG_EXTS, 'glob');
46
+        $loader->load($confDir . '/services' . self::CONFIG_EXTS, 'glob');
47
+        $loader->load($confDir . '/services_' . $this->environment . self::CONFIG_EXTS, 'glob');
48 48
     }
49 49
 
50 50
     protected function configureRoutes(RouteCollectionBuilder $routes)
51 51
     {
52
-        $confDir = $this->getProjectDir().'/config';
53
-        if (is_dir($confDir.'/routes/')) {
54
-            $routes->import($confDir.'/routes/*'.self::CONFIG_EXTS, '/', 'glob');
52
+        $confDir = $this->getProjectDir() . '/config';
53
+        if (is_dir($confDir . '/routes/')) {
54
+            $routes->import($confDir . '/routes/*' . self::CONFIG_EXTS, '/', 'glob');
55 55
         }
56
-        if (is_dir($confDir.'/routes/'.$this->environment)) {
57
-            $routes->import($confDir.'/routes/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
56
+        if (is_dir($confDir . '/routes/' . $this->environment)) {
57
+            $routes->import($confDir . '/routes/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');
58 58
         }
59
-        $routes->import($confDir.'/routes'.self::CONFIG_EXTS, '/', 'glob');
59
+        $routes->import($confDir . '/routes' . self::CONFIG_EXTS, '/', 'glob');
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
src/TwigExtension/TranslatorExtension.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,10 +83,10 @@
 block discarded – undo
83 83
      */
84 84
     public function languagesAvailable()
85 85
     {
86
-       $languages = [];
87
-       foreach ($this->container->getParameter('dictionaries') as $languageId => $dictionary) {
88
-           $languages += [ $dictionary['self_name'] => $languageId ];
89
-       }
86
+        $languages = [];
87
+        foreach ($this->container->getParameter('dictionaries') as $languageId => $dictionary) {
88
+            $languages += [ $dictionary['self_name'] => $languageId ];
89
+        }
90 90
         return $languages;
91 91
     }
92 92
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
     {
86 86
        $languages = [];
87 87
        foreach ($this->container->getParameter('dictionaries') as $languageId => $dictionary) {
88
-           $languages += [ $dictionary['self_name'] => $languageId ];
88
+           $languages += [$dictionary['self_name'] => $languageId];
89 89
        }
90 90
         return $languages;
91 91
     }
Please login to merge, or discard this patch.
src/Event/AdminSubscriber.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,6 +43,6 @@
 block discarded – undo
43 43
 
44 44
     public static function getSubscribedEvents()
45 45
     {
46
-        return [ KernelEvents::CONTROLLER => 'onKernelController' ];
46
+        return [KernelEvents::CONTROLLER => 'onKernelController'];
47 47
     }
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,17 +36,21 @@
 block discarded – undo
36 36
         if ($controller[0] instanceof AdminAuthenticatedInterface) {
37 37
             $isAdmin = false;
38 38
             if (isset($_SESSION['phpCAS']['user'])) {
39
-                if (in_array($_SESSION['phpCAS']['user'], $this->administrators))
40
-                    $isAdmin = true;
39
+                if (in_array($_SESSION['phpCAS']['user'], $this->administrators)) {
40
+                                    $isAdmin = true;
41
+                }
42
+            }
43
+            if (!$isAdmin) {
44
+                throw new AccessDeniedHttpException('Access forbidden.');
41 45
             }
42
-            if (!$isAdmin) throw new AccessDeniedHttpException('Access forbidden.');
43 46
         }
44 47
     }
45 48
 
46 49
     public function onKernelRequest(GetResponseEvent $event)
47 50
     {
48
-        if (HttpKernel::MASTER_REQUEST != $event->getRequestType())
49
-            return;
51
+        if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
52
+                    return;
53
+        }
50 54
     }
51 55
 
52 56
 
Please login to merge, or discard this patch.
src/Event/LocaleListener.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,6 +58,6 @@
 block discarded – undo
58 58
 
59 59
     public static function getSubscribedEvents()
60 60
     {
61
-        return [ KernelEvents::REQUEST => [['onKernelRequest', 200]] ];
61
+        return [KernelEvents::REQUEST => [['onKernelRequest', 200]]];
62 62
     }
63 63
 }
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@
 block discarded – undo
33 33
      */
34 34
     public function onKernelRequest(GetResponseEvent $event)
35 35
     {
36
-        if (HttpKernel::MASTER_REQUEST != $event->getRequestType())
37
-            return;
36
+        if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
37
+                    return;
38
+        }
38 39
 
39 40
         $this->registerLDAP();
40 41
         $this->registerCapsule();
Please login to merge, or discard this patch.
src/Controller/AbstractController.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
14 14
 use Symfony\Component\DependencyInjection\ContainerInterface;
15 15
 
16
- abstract class AbstractController extends Controller
16
+    abstract class AbstractController extends Controller
17 17
 {
18 18
 
19 19
     /**
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
         $container->set('http', self::$http);
34 34
     }
35 35
 
36
-     /**
37
-      * Creates and return a JSON Web Token through the OpenLRW API by using credentials filled in .env
38
-      *
39
-      * @return mixed|\Psr\Http\Message\ResponseInterface
40
-      * @throws \GuzzleHttp\Exception\GuzzleException
41
-      */
36
+        /**
37
+         * Creates and return a JSON Web Token through the OpenLRW API by using credentials filled in .env
38
+         *
39
+         * @return mixed|\Psr\Http\Message\ResponseInterface
40
+         * @throws \GuzzleHttp\Exception\GuzzleException
41
+         */
42 42
     public static function generateJwt()
43 43
     {
44 44
         $_SESSION['JWT'] = json_decode( self::$http->request('POST', 'api/auth/login', [
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 'password' => env('API_PASSWORD')
49 49
             ]
50 50
         ])->getBody()
51
-          ->getContents())->token;
51
+            ->getContents())->token;
52 52
 
53 53
         return $_SESSION['JWT'];
54 54
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@
 block discarded – undo
41 41
       */
42 42
     public static function generateJwt()
43 43
     {
44
-        $_SESSION['JWT'] = json_decode( self::$http->request('POST', 'api/auth/login', [
45
-            'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' ],
44
+        $_SESSION['JWT'] = json_decode(self::$http->request('POST', 'api/auth/login', [
45
+            'headers' => ['X-Requested-With' => 'XMLHttpRequest'],
46 46
             'json' => [
47 47
                 'username' => env('API_USERNAME'),
48 48
                 'password' => env('API_PASSWORD')
Please login to merge, or discard this patch.
src/Controller/AdminController.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
             $students = $this->ldap($filter, ['displayname', 'uid']);
36 36
             $res = [];
37 37
 
38
-            foreach($students as $student) {
38
+            foreach ($students as $student) {
39 39
                 if ($student['uid'][0] != null)
40
-                    $res += [ $student['uid'][0] => $student['displayname'][0] ];
40
+                    $res += [$student['uid'][0] => $student['displayname'][0]];
41 41
             }
42 42
 
43 43
             return $this->json($res);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             'givenName' => $user->givenName,
91 91
             'classes' => null,
92 92
             'events' => $events,
93
-            'event_activities' => json_encode($activities, JSON_UNESCAPED_SLASHES )
93
+            'event_activities' => json_encode($activities, JSON_UNESCAPED_SLASHES)
94 94
         ]);
95 95
 
96 96
     }
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,10 +86,10 @@
 block discarded – undo
86 86
             $activities = array_count_values($activities);
87 87
         }
88 88
 
89
-       //foreach (json_decode($enrollments->getBody()->getContents()) as $enrollment) {
90
-       //    if ($enrollment->class->title != null)
91
-       //        array_push($classes, $enrollment->class);
92
-       //}
89
+        //foreach (json_decode($enrollments->getBody()->getContents()) as $enrollment) {
90
+        //    if ($enrollment->class->title != null)
91
+        //        array_push($classes, $enrollment->class);
92
+        //}
93 93
 
94 94
         return $this->render('Admin/user.twig', [
95 95
             'givenName' => $user->givenName,
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@  discard block
 block discarded – undo
36 36
             $res = [];
37 37
 
38 38
             foreach($students as $student) {
39
-                if ($student['uid'][0] != null)
40
-                    $res += [ $student['uid'][0] => $student['displayname'][0] ];
39
+                if ($student['uid'][0] != null) {
40
+                                    $res += [ $student['uid'][0] => $student['displayname'][0] ];
41
+                }
41 42
             }
42 43
 
43 44
             return $this->json($res);
@@ -80,8 +81,9 @@  discard block
 block discarded – undo
80 81
 
81 82
         if ($events != null)
82 83
         {
83
-            foreach ($events as $event)
84
-                array_push($activities, $event->object->name);
84
+            foreach ($events as $event) {
85
+                            array_push($activities, $event->object->name);
86
+            }
85 87
 
86 88
             $activities = array_count_values($activities);
87 89
         }
Please login to merge, or discard this patch.
src/Model/API/ApiModel.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,10 +60,10 @@
 block discarded – undo
60 60
      */
61 61
     public function post(String $route, array $args) // ToDo : add JWT
62 62
     {
63
-       return json_decode( self::$http->request('POST', $route, [
64
-           'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' ],
65
-           'json' => $args
66
-       ])->getBody()->getContents());
63
+        return json_decode( self::$http->request('POST', $route, [
64
+            'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' ],
65
+            'json' => $args
66
+        ])->getBody()->getContents());
67 67
     }
68 68
 
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@
 block discarded – undo
60 60
      */
61 61
     public function post(String $route, array $args) // ToDo : add JWT
62 62
     {
63
-       return json_decode( self::$http->request('POST', $route, [
64
-           'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' ],
63
+       return json_decode(self::$http->request('POST', $route, [
64
+           'headers' => ['X-Requested-With' => 'XMLHttpRequest'],
65 65
            'json' => $args
66 66
        ])->getBody()->getContents());
67 67
     }
Please login to merge, or discard this patch.
src/Event/StudentSubscriber.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,6 +43,6 @@
 block discarded – undo
43 43
 
44 44
     public static function getSubscribedEvents()
45 45
     {
46
-        return [ KernelEvents::CONTROLLER => 'onKernelController' ];
46
+        return [KernelEvents::CONTROLLER => 'onKernelController'];
47 47
     }
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,9 @@
 block discarded – undo
42 42
 
43 43
     public function onKernelRequest(GetResponseEvent $event)
44 44
     {
45
-        if (HttpKernel::MASTER_REQUEST != $event->getRequestType())
46
-            return;
45
+        if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
46
+                    return;
47
+        }
47 48
     }
48 49
 
49 50
 
Please login to merge, or discard this patch.