Passed
Branch master (acb992)
by Alexis
03:30
created
Category
public/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@
 block discarded – undo
5 5
 
6 6
 session_start();
7 7
 
8
-require __DIR__.'/../vendor/autoload.php';
8
+require __DIR__ . '/../vendor/autoload.php';
9 9
 
10 10
 if (!isset($_SERVER['APP_ENV'])) {
11 11
     if (!class_exists(Dotenv::class)) {
12 12
         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.');
13 13
     }
14
-    (new Dotenv())->load(__DIR__.'/../.env');
14
+    (new Dotenv())->load(__DIR__ . '/../.env');
15 15
 }
16 16
 
17 17
 $app = new Application($_SERVER['APP_ENV'] ?? 'dev');
Please login to merge, or discard this patch.
tests/WebTestCase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
             if (!class_exists(Dotenv::class)) {
47 47
                 throw new \RuntimeException('APP_TEST_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.');
48 48
             }
49
-            (new Dotenv())->load(__DIR__.'/../.env');
49
+            (new Dotenv())->load(__DIR__ . '/../.env');
50 50
         }
51 51
 
52 52
         $app = new Application($_SERVER['APP_TEST_ENV'] ?? 'test');
Please login to merge, or discard this patch.
src/Middleware/Authorization.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
             return [null];
90 90
         }
91 91
 
92
-        array_walk($scopes, function (&$scope) {
92
+        array_walk($scopes, function(&$scope) {
93 93
             if (is_array($scope)) {
94 94
                 $scope = implode(' ', $scope);
95 95
             }
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function getCacheDir()
39 39
     {
40
-        return $this->getRootDir().'/var/cache/'.$this->environment;
40
+        return $this->getRootDir() . '/var/cache/' . $this->environment;
41 41
     }
42 42
 
43 43
     public function getConfigurationDir()
44 44
     {
45
-        return $this->getRootDir().'/config';
45
+        return $this->getRootDir() . '/config';
46 46
     }
47 47
 
48 48
     public function getEnvironment()
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
     public function getLogDir()
54 54
     {
55
-        return $this->getRootDir().'/var/log';
55
+        return $this->getRootDir() . '/var/log';
56 56
     }
57 57
 
58 58
     public function getRootDir()
@@ -67,20 +67,20 @@  discard block
 block discarded – undo
67 67
     protected function configureContainer()
68 68
     {
69 69
         $container = $this->getContainer();
70
-        require $this->getConfigurationDir().'/container.php';
70
+        require $this->getConfigurationDir() . '/container.php';
71 71
     }
72 72
 
73 73
     protected function loadConfiguration()
74 74
     {
75 75
         $app = $this;
76 76
         $configuration = [
77
-            'settings' => require $this->getConfigurationDir().'/slim.php'
77
+            'settings' => require $this->getConfigurationDir() . '/slim.php'
78 78
         ];
79 79
 
80
-        if (file_exists($this->getConfigurationDir().'/services.'.$this->getEnvironment().'.php')) {
81
-            $configuration['settings'] += require $this->getConfigurationDir().'/services.'.$this->getEnvironment().'.php';
80
+        if (file_exists($this->getConfigurationDir() . '/services.' . $this->getEnvironment() . '.php')) {
81
+            $configuration['settings'] += require $this->getConfigurationDir() . '/services.' . $this->getEnvironment() . '.php';
82 82
         } else {
83
-            $configuration['settings'] += require $this->getConfigurationDir().'/services.php';
83
+            $configuration['settings'] += require $this->getConfigurationDir() . '/services.php';
84 84
         }
85 85
 
86 86
         return $configuration;
@@ -90,23 +90,23 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $app = $this;
92 92
         $container = $this->getContainer();
93
-        require $this->getConfigurationDir().'/middleware.php';
93
+        require $this->getConfigurationDir() . '/middleware.php';
94 94
     }
95 95
 
96 96
     protected function loadRoutes()
97 97
     {
98 98
         $app = $this;
99 99
         $container = $this->getContainer();
100
-        require $this->getConfigurationDir().'/routes.php';
100
+        require $this->getConfigurationDir() . '/routes.php';
101 101
     }
102 102
 
103 103
     protected function registerControllers()
104 104
     {
105 105
         $container = $this->getContainer();
106
-        if (file_exists($this->getConfigurationDir().'/controllers.php')) {
107
-            $controllers = require $this->getConfigurationDir().'/controllers.php';
106
+        if (file_exists($this->getConfigurationDir() . '/controllers.php')) {
107
+            $controllers = require $this->getConfigurationDir() . '/controllers.php';
108 108
             foreach ($controllers as $key => $class) {
109
-                $container[$key] = function ($container) use ($class) {
109
+                $container[$key] = function($container) use ($class) {
110 110
                     return new $class($container);
111 111
                 };
112 112
             }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     protected function registerHandlers()
117 117
     {
118 118
         $container = $this->getContainer();
119
-        $handlers = require $this->getConfigurationDir().'/handlers.php';
119
+        $handlers = require $this->getConfigurationDir() . '/handlers.php';
120 120
         foreach ($handlers as $name => $callable) {
121 121
             $container[$name] = $callable;
122 122
         }
Please login to merge, or discard this patch.
config/database/oauth.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use Illuminate\Database\Capsule\Manager;
4 4
 use Illuminate\Database\Schema\Blueprint;
5 5
 
6
-Manager::schema()->create('oauth_clients', function (Blueprint $table) {
6
+Manager::schema()->create('oauth_clients', function(Blueprint $table) {
7 7
     $table->string('client_id', 80);
8 8
     $table->string('client_secret', 80)->nullable();
9 9
     $table->string('redirect_uri', 2000)->nullable();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     $table->primary('client_id');
15 15
 });
16 16
 
17
-Manager::schema()->create('oauth_access_tokens', function (Blueprint $table) {
17
+Manager::schema()->create('oauth_access_tokens', function(Blueprint $table) {
18 18
     $table->string('access_token', 40);
19 19
     $table->string('client_id', 80);
20 20
     $table->string('user_id', 80)->nullable();
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     $table->primary('access_token');
25 25
 });
26 26
 
27
-Manager::schema()->create('oauth_authorization_codes', function (Blueprint $table) {
27
+Manager::schema()->create('oauth_authorization_codes', function(Blueprint $table) {
28 28
     $table->string('authorization_code', 40);
29 29
     $table->string('client_id', 80);
30 30
     $table->string('user_id', 80)->nullable();
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     $table->primary('authorization_code');
37 37
 });
38 38
 
39
-Manager::schema()->create('oauth_refresh_tokens', function (Blueprint $table) {
39
+Manager::schema()->create('oauth_refresh_tokens', function(Blueprint $table) {
40 40
     $table->string('refresh_token', 40);
41 41
     $table->string('client_id', 80);
42 42
     $table->string('user_id', 80)->nullable();
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
     $table->primary('refresh_token');
47 47
 });
48 48
 
49
-Manager::schema()->create('oauth_scopes', function (Blueprint $table) {
49
+Manager::schema()->create('oauth_scopes', function(Blueprint $table) {
50 50
     $table->string('scope', 80);
51 51
     $table->boolean('is_default')->nullable();
52 52
 
53 53
     $table->primary('scope');
54 54
 });
55 55
 
56
-Manager::schema()->create('oauth_jwt', function (Blueprint $table) {
56
+Manager::schema()->create('oauth_jwt', function(Blueprint $table) {
57 57
     $table->string('client_id', 80);
58 58
     $table->string('subject', 80)->nullable();
59 59
     $table->string('public_key', 2000);
Please login to merge, or discard this patch.
config/database/sentinel.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 use Cartalyst\Sentinel\Native\Facades\Sentinel;
6 6
 use Cartalyst\Sentinel\Native\SentinelBootstrapper;
7 7
 
8
-$sentinel = (new Sentinel(new SentinelBootstrapper(__DIR__.'/../sentinel.php')))->getSentinel();
8
+$sentinel = (new Sentinel(new SentinelBootstrapper(__DIR__ . '/../sentinel.php')))->getSentinel();
9 9
 
10
-Manager::schema()->create('user', function (Blueprint $table) {
10
+Manager::schema()->create('user', function(Blueprint $table) {
11 11
     $table->increments('id');
12 12
     $table->string('username')->unique();
13 13
     $table->string('email')->unique();
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     $table->timestamps();
21 21
 });
22 22
 
23
-Manager::schema()->create('activations', function (Blueprint $table) {
23
+Manager::schema()->create('activations', function(Blueprint $table) {
24 24
     $table->increments('id');
25 25
     $table->unsignedInteger('user_id');
26 26
     $table->string('code');
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     $table->foreign('user_id')->references('id')->on('user');
31 31
 });
32 32
 
33
-Manager::schema()->create('persistences', function (Blueprint $table) {
33
+Manager::schema()->create('persistences', function(Blueprint $table) {
34 34
     $table->increments('id');
35 35
     $table->unsignedInteger('user_id');
36 36
     $table->string('code')->unique();
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     $table->foreign('user_id')->references('id')->on('user');
39 39
 });
40 40
 
41
-Manager::schema()->create('reminders', function (Blueprint $table) {
41
+Manager::schema()->create('reminders', function(Blueprint $table) {
42 42
     $table->increments('id');
43 43
     $table->unsignedInteger('user_id');
44 44
     $table->string('code');
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     $table->foreign('user_id')->references('id')->on('user');
49 49
 });
50 50
 
51
-Manager::schema()->create('roles', function (Blueprint $table) {
51
+Manager::schema()->create('roles', function(Blueprint $table) {
52 52
     $table->increments('id');
53 53
     $table->string('slug')->unique();
54 54
     $table->string('name');
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     $table->timestamps();
57 57
 });
58 58
 
59
-Manager::schema()->create('role_users', function (Blueprint $table) {
59
+Manager::schema()->create('role_users', function(Blueprint $table) {
60 60
     $table->unsignedInteger('user_id');
61 61
     $table->unsignedInteger('role_id');
62 62
     $table->timestamps();
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     $table->foreign('role_id')->references('id')->on('roles');
66 66
 });
67 67
 
68
-Manager::schema()->create('throttle', function (Blueprint $table) {
68
+Manager::schema()->create('throttle', function(Blueprint $table) {
69 69
     $table->increments('id');
70 70
     $table->unsignedInteger('user_id')->nullable();
71 71
     $table->string('type');
Please login to merge, or discard this patch.
config/database/index.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 Illuminate\Database\Capsule\Manager::schema()->defaultStringLength(191);
4 4
 
5 5
 // Drop all tables
6
-require __DIR__.'/drop.php';
6
+require __DIR__ . '/drop.php';
7 7
 
8 8
 // Create tables
9
-require __DIR__.'/sentinel.php';
10
-require __DIR__.'/oauth.php';
11
-require __DIR__.'/app.php';
9
+require __DIR__ . '/sentinel.php';
10
+require __DIR__ . '/oauth.php';
11
+require __DIR__ . '/app.php';
Please login to merge, or discard this patch.
config/routes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
 /**
8 8
  * CORS Pre-flight request.
9 9
  */
10
-$app->options('/{routes:.+}', function ($request, $response) {
10
+$app->options('/{routes:.+}', function($request, $response) {
11 11
     return $response;
12 12
 });
13 13
 
14 14
 /**
15 15
  * Security.
16 16
  */
17
-$app->group('/', function () use ($container) {
17
+$app->group('/', function() use ($container) {
18 18
     $this->post('register', 'registration.controller:register')->setName('register');
19 19
     $this->post('oauth/v2/token', 'token.controller:token')->setName('oauth_token');
20 20
     $this->get('user', 'token.controller:user')
Please login to merge, or discard this patch.
config/handlers.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      *
17 17
      * https://www.slimframework.com/docs/objects/router.html#route-strategies
18 18
      */
19
-    'foundHandler' => function ($container) {
19
+    'foundHandler' => function($container) {
20 20
         /** @var Request $request */
21 21
         $request = $container['request'];
22 22
         $container['monolog']->info(sprintf('Matched route "%s /%s"', $request->getMethod(), ltrim($request->getUri()->getPath(), '/')));
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
     /**
28 28
      * Returns an error in JSON when a NotFoundException is thrown.
29 29
      */
30
-    'notFoundHandler' => function ($container) {
31
-        return function (Request $request, Response $response) use ($container) {
30
+    'notFoundHandler' => function($container) {
31
+        return function(Request $request, Response $response) use ($container) {
32 32
             $container['monolog']->error(sprintf('No resource found for "%s /%s"', $request->getMethod(), ltrim($request->getUri()->getPath(), '/')));
33 33
 
34 34
             return $response
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
     /**
44 44
      * Returns an error in JSON when the HTTP method is not allowed.
45 45
      */
46
-    'notAllowedHandler' => function ($container) {
47
-        return function (Request $request, Response $response, array $methods) use ($container) {
46
+    'notAllowedHandler' => function($container) {
47
+        return function(Request $request, Response $response, array $methods) use ($container) {
48 48
             $allowedMethods = implode(', ', $methods);
49 49
 
50 50
             $container['monolog']->error(sprintf(
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                 ->withHeader('Allow', $allowedMethods)
64 64
                 ->withJson([
65 65
                     'status' => 405,
66
-                    'message' => 'Method must be one of: '.$allowedMethods
66
+                    'message' => 'Method must be one of: ' . $allowedMethods
67 67
                 ]);
68 68
         };
69 69
     },
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
     /**
72 72
      * Returns an error in JSON when an UnauthorizedException is thrown.
73 73
      */
74
-    'unauthorizedHandler' => function ($container) {
75
-        return function (Request $request, Response $response, Exception $exception) use ($container) {
74
+    'unauthorizedHandler' => function($container) {
75
+        return function(Request $request, Response $response, Exception $exception) use ($container) {
76 76
             $container['monolog']->debug('Unauthorized, the user is not authenticated', [
77 77
                 'exception' => $exception
78 78
             ]);
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
     /**
90 90
      * Returns an error in JSON when an AccessDeniedException is thrown.
91 91
      */
92
-    'accessDeniedHandler' => function ($container) {
93
-        return function (Request $request, Response $response, Exception $exception) use ($container) {
92
+    'accessDeniedHandler' => function($container) {
93
+        return function(Request $request, Response $response, Exception $exception) use ($container) {
94 94
             $container['monolog']->debug('Access denied, the user does not have access to this section', [
95 95
                 'exception' => $exception
96 96
             ]);
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
     /**
108 108
      * Default Slim error handler.
109 109
      */
110
-    'errorHandler' => function ($container) {
111
-        return function (Request $request, Response $response, Exception $exception) use ($container) {
110
+    'errorHandler' => function($container) {
111
+        return function(Request $request, Response $response, Exception $exception) use ($container) {
112 112
             if ($exception instanceof AccessDeniedException) {
113 113
                 return $container['accessDeniedHandler']($request, $response, $exception);
114 114
             }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                 return $container['unauthorizedHandler']($request, $response, $exception);
118 118
             }
119 119
 
120
-            $container['monolog']->error('Uncaught PHP Exception '.get_class($exception), [
120
+            $container['monolog']->error('Uncaught PHP Exception ' . get_class($exception), [
121 121
                 'exception' => $exception
122 122
             ]);
123 123
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
             if ('dev' === $this->getEnvironment()) {
130 130
                 $message['trace'] = $exception->getTrace();
131
-                $message['message'] = get_class($exception).': '.$exception->getMessage();
131
+                $message['message'] = get_class($exception) . ': ' . $exception->getMessage();
132 132
             }
133 133
 
134 134
             return $response
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
     /**
141 141
      * PHP error handler.
142 142
      */
143
-    'phpErrorHandler' => function ($container) {
144
-        return function (Request $request, Response $response, Throwable $error) use ($container) {
145
-            $container['monolog']->critical('Uncaught PHP Exception '.get_class($error), [
143
+    'phpErrorHandler' => function($container) {
144
+        return function(Request $request, Response $response, Throwable $error) use ($container) {
145
+            $container['monolog']->critical('Uncaught PHP Exception ' . get_class($error), [
146 146
                 'exception' => $error
147 147
             ]);
148 148
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
             if ('dev' === $this->getEnvironment()) {
155 155
                 $message['trace'] = $error->getTrace();
156
-                $message['message'] = get_class($error).': '.$error->getMessage();
156
+                $message['message'] = get_class($error) . ': ' . $error->getMessage();
157 157
             }
158 158
 
159 159
             return $response
Please login to merge, or discard this patch.