Passed
Push — develop ( 36c2b4...1d782e )
by nguereza
03:02
created
src/Demo/API/Provider/UserServiceProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
      */
73 73
     public function addRoutes(Router $router): void
74 74
     {
75
-        $router->group('/api', function (Router $router) {
75
+        $router->group('/api', function(Router $router) {
76 76
             $router->post('/auth/login', LoginAction::class, 'auth_login');
77 77
         });
78 78
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@
 block discarded – undo
56 56
  * @class UserServiceProvider
57 57
  * @package Platine\Framework\Demo\API\Provider
58 58
  */
59
-class UserServiceProvider extends ServiceProvider
60
-{
59
+class UserServiceProvider extends ServiceProvider {
61 60
 
62 61
     /**
63 62
      * {@inheritdoc}
Please login to merge, or discard this patch.
src/Demo/API/Validator/LoginValidator.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,12 +91,12 @@
 block discarded – undo
91 91
     public function setValidationRules(): void
92 92
     {
93 93
         $this->addRules('username', [
94
-           new NotEmpty(),
95
-           new MinLength(3)
94
+            new NotEmpty(),
95
+            new MinLength(3)
96 96
         ]);
97 97
 
98 98
         $this->addRules('password', [
99
-           new NotEmpty(),
99
+            new NotEmpty(),
100 100
         ]);
101 101
     }
102 102
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
  * @class LoginValidator
58 58
  * @package Platine\Framework\Demo\API\Validator
59 59
  */
60
-class LoginValidator extends AbstractValidator
61
-{
60
+class LoginValidator extends AbstractValidator {
62 61
     /**
63 62
      * The parameter instance
64 63
      * @var LoginParam
@@ -70,8 +69,7 @@  discard block
 block discarded – undo
70 69
      * @param LoginParam $param
71 70
      * @param Lang $lang
72 71
      */
73
-    public function __construct(LoginParam $param, Lang $lang)
74
-    {
72
+    public function __construct(LoginParam $param, Lang $lang) {
75 73
         parent::__construct($lang);
76 74
         $this->param = $param;
77 75
     }
Please login to merge, or discard this patch.
src/Demo/API/Param/LoginParam.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@
 block discarded – undo
53 53
  * @class LoginParam
54 54
  * @package Platine\Framework\Demo\API\Param
55 55
  */
56
-class LoginParam extends BaseParam
57
-{
56
+class LoginParam extends BaseParam {
58 57
     /**
59 58
      * The username
60 59
      * @var string
Please login to merge, or discard this patch.
src/Auth/Middleware/ApiAuthenticationMiddleware.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@
 block discarded – undo
61 61
  * @package Platine\Framework\Auth\Middleware
62 62
  * @template T
63 63
  */
64
-class ApiAuthenticationMiddleware implements MiddlewareInterface
65
-{
64
+class ApiAuthenticationMiddleware implements MiddlewareInterface {
66 65
 
67 66
     /**
68 67
      * The Authentication instance
Please login to merge, or discard this patch.
src/Auth/Authentication/JWTAuthentication.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     public function getUser(): IdentityInterface
129 129
     {
130 130
         //if (!$this->isLogged()) {
131
-           // throw new AccountNotFoundException('User not logged', 401);
131
+            // throw new AccountNotFoundException('User not logged', 401);
132 132
         //}
133 133
 
134 134
         // $id = $this->session->get('user.id');
@@ -223,23 +223,23 @@  discard block
 block discarded – undo
223 223
         $expire = $this->config->get('api.auth.expire', 1800);
224 224
         $tokenExpire = time() + $expire;
225 225
         $this->jwt->setSecret($secret)
226
-                  ->setPayload([
227
-                      'id' => $user->id,
228
-                      'exp' => $tokenExpire,
229
-                  ])
230
-                  ->sign();
226
+                    ->setPayload([
227
+                        'id' => $user->id,
228
+                        'exp' => $tokenExpire,
229
+                    ])
230
+                    ->sign();
231 231
 
232 232
         $data = [
233
-          'user' => [
233
+            'user' => [
234 234
             'id' => $user->id,
235 235
             'username' => $user->username,
236 236
             'lastname' => $user->lastname,
237 237
             'firstname' => $user->firstname,
238 238
             'permissions' => array_unique($permissions),
239
-          ],
240
-          'token' => $this->jwt->getToken(),
241
-          'refresh_token' => '',
242
-          'expire_at' => $tokenExpire,
239
+            ],
240
+            'token' => $this->jwt->getToken(),
241
+            'refresh_token' => '',
242
+            'expire_at' => $tokenExpire,
243 243
         ];
244 244
 
245 245
         return $data;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@
 block discarded – undo
67 67
  * @package Platine\Framework\Auth\Authentication
68 68
  * @template T
69 69
  */
70
-class JWTAuthentication implements ApiAuthenticationInterface
71
-{
70
+class JWTAuthentication implements ApiAuthenticationInterface {
72 71
 
73 72
     /**
74 73
      * The JWT instance
Please login to merge, or discard this patch.
src/Auth/ApiAuthenticationInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@
 block discarded – undo
53 53
  * @class ApiAuthenticationInterface
54 54
  * @package Platine\Framework\Auth
55 55
  */
56
-interface ApiAuthenticationInterface
57
-{
56
+interface ApiAuthenticationInterface {
58 57
 
59 58
     /**
60 59
      * Whether the request is authenticated
Please login to merge, or discard this patch.