Passed
Push — develop ( e15637...8f1c0c )
by nguereza
02:54
created
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/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.
src/Auth/Entity/Token.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@
 block discarded – undo
54 54
  * @class Token
55 55
  * @package Platine\Framework\Auth\Entity
56 56
  */
57
-class Token extends Entity
58
-{
57
+class Token extends Entity {
59 58
 
60 59
     /**
61 60
      * {@inheritdoc}
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
             'updated_at' => '?date',
71 71
         ]);
72 72
         
73
-        $mapper->filter('not_expire', function (Query $q, $date) {
73
+        $mapper->filter('not_expire', function(Query $q, $date) {
74 74
             $q->where('expire_at')->gt($date);
75 75
         });
76 76
     }
Please login to merge, or discard this patch.
src/Auth/Repository/TokenRepository.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,15 +55,13 @@
 block discarded – undo
55 55
  * @class TokenRepository
56 56
  * @package Platine\Framework\Auth\Repository
57 57
  */
58
-class TokenRepository extends Repository
59
-{
58
+class TokenRepository extends Repository {
60 59
 
61 60
     /**
62 61
      * Create new instance
63 62
      * @param EntityManager $manager
64 63
      */
65
-    public function __construct(EntityManager $manager)
66
-    {
64
+    public function __construct(EntityManager $manager) {
67 65
         parent::__construct($manager, Token::class);
68 66
     }
69 67
 }
Please login to merge, or discard this patch.
src/Auth/Authentication/JWTAuthentication.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
         $tokenExpire = time() + $expire;
250 250
         $refreshTokenExpire = time() + $refreshExpire;
251 251
         $this->jwt->setSecret($secret)
252
-                  ->setPayload([
253
-                      'sub' => $user->id,
254
-                      'exp' => $tokenExpire,
255
-                  ])
256
-                  ->sign();
252
+                    ->setPayload([
253
+                        'sub' => $user->id,
254
+                        'exp' => $tokenExpire,
255
+                    ])
256
+                    ->sign();
257 257
         $refreshToken = Str::randomToken(24);
258 258
         $jwtToken = $this->jwt->getToken();
259 259
 
@@ -267,15 +267,15 @@  discard block
 block discarded – undo
267 267
         $this->tokenRepository->save($token);
268 268
 
269 269
         $data = [
270
-          'user' => [
270
+            'user' => [
271 271
             'id' => $user->id,
272 272
             'username' => $user->username,
273 273
             'lastname' => $user->lastname,
274 274
             'firstname' => $user->firstname,
275 275
             'permissions' => $permissions,
276
-          ],
277
-          'token' => $jwtToken,
278
-          'refresh_token' => $refreshToken,
276
+            ],
277
+            'token' => $jwtToken,
278
+            'refresh_token' => $refreshToken,
279 279
         ];
280 280
 
281 281
         return $data;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@
 block discarded – undo
237 237
         foreach ($roles as $role) {
238 238
             $rolePermissions = $role->permissions;
239 239
             foreach ($rolePermissions as $permission) {
240
-                if(!in_array($permission->code, $permissions)){
240
+                if (!in_array($permission->code, $permissions)) {
241 241
                     $permissions[] = $permission->code;
242 242
                 }
243 243
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,8 +69,7 @@  discard block
 block discarded – undo
69 69
  * @package Platine\Framework\Auth\Authentication
70 70
  * @template T
71 71
  */
72
-class JWTAuthentication implements ApiAuthenticationInterface
73
-{
72
+class JWTAuthentication implements ApiAuthenticationInterface {
74 73
 
75 74
     /**
76 75
      * The JWT instance
@@ -237,7 +236,7 @@  discard block
 block discarded – undo
237 236
         foreach ($roles as $role) {
238 237
             $rolePermissions = $role->permissions;
239 238
             foreach ($rolePermissions as $permission) {
240
-                if(!in_array($permission->code, $permissions)){
239
+                if(!in_array($permission->code, $permissions)) {
241 240
                     $permissions[] = $permission->code;
242 241
                 }
243 242
             }
Please login to merge, or discard this patch.