Passed
Push — develop ( 51cd0e...2c6a1d )
by nguereza
03:43
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/Authentication/JWTAuthentication.php 2 patches
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.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     public function getUser(): IdentityInterface
140 140
     {
141 141
         //if (!$this->isLogged()) {
142
-           // throw new AccountNotFoundException('User not logged', 401);
142
+            // throw new AccountNotFoundException('User not logged', 401);
143 143
         //}
144 144
 
145 145
         // $id = $this->session->get('user.id');
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
         $tokenExpire = time() + $expire;
237 237
         $refreshTokenExpire = time() + $refreshExpire;
238 238
         $this->jwt->setSecret($secret)
239
-                  ->setPayload([
240
-                      'sub' => $user->id,
241
-                      'exp' => $tokenExpire,
242
-                  ])
243
-                  ->sign();
239
+                    ->setPayload([
240
+                        'sub' => $user->id,
241
+                        'exp' => $tokenExpire,
242
+                    ])
243
+                    ->sign();
244 244
         $refreshToken = Str::randomToken(24);
245 245
         $jwtToken = $this->jwt->getToken();
246 246
 
@@ -254,15 +254,15 @@  discard block
 block discarded – undo
254 254
         $this->tokenRepository->save($token);
255 255
 
256 256
         $data = [
257
-          'user' => [
257
+            'user' => [
258 258
             'id' => $user->id,
259 259
             'username' => $user->username,
260 260
             'lastname' => $user->lastname,
261 261
             'firstname' => $user->firstname,
262 262
             'permissions' => array_unique($permissions),
263
-          ],
264
-          'token' => $jwtToken,
265
-          'refresh_token' => $refreshToken,
263
+            ],
264
+            'token' => $jwtToken,
265
+            'refresh_token' => $refreshToken,
266 266
         ];
267 267
 
268 268
         return $data;
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.