@@ -212,10 +212,10 @@ |
||
| 212 | 212 | return $this; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - /** |
|
| 216 | - * Return the application root path |
|
| 217 | - * @return string |
|
| 218 | - */ |
|
| 215 | + /** |
|
| 216 | + * Return the application root path |
|
| 217 | + * @return string |
|
| 218 | + */ |
|
| 219 | 219 | public function getAppPath(): string |
| 220 | 220 | { |
| 221 | 221 | return $this->appPath; |
@@ -65,8 +65,7 @@ discard block |
||
| 65 | 65 | * @class Application |
| 66 | 66 | * @package Platine\Framework\App |
| 67 | 67 | */ |
| 68 | -class Application extends Container |
|
| 69 | -{ |
|
| 68 | +class Application extends Container { |
|
| 70 | 69 | /** |
| 71 | 70 | * The application version |
| 72 | 71 | */ |
@@ -148,8 +147,7 @@ discard block |
||
| 148 | 147 | * Create new instance |
| 149 | 148 | * @param string $basePath |
| 150 | 149 | */ |
| 151 | - public function __construct(string $basePath = '') |
|
| 152 | - { |
|
| 150 | + public function __construct(string $basePath = '') { |
|
| 153 | 151 | parent::__construct(); |
| 154 | 152 | |
| 155 | 153 | $this->basePath = $basePath; |
@@ -244,8 +242,7 @@ discard block |
||
| 244 | 242 | * @param string $env |
| 245 | 243 | * @return $this |
| 246 | 244 | */ |
| 247 | - public function setEnvironment(string $env) |
|
| 248 | - { |
|
| 245 | + public function setEnvironment(string $env) { |
|
| 249 | 246 | $this->env = $env; |
| 250 | 247 | |
| 251 | 248 | return $this; |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | * @class AuthorizationInterface |
| 52 | 52 | * @package Platine\Framework\Auth |
| 53 | 53 | */ |
| 54 | -interface AuthorizationInterface |
|
| 55 | -{ |
|
| 54 | +interface AuthorizationInterface { |
|
| 56 | 55 | /** |
| 57 | 56 | * Check if user is granted the given permission |
| 58 | 57 | * @param string $permission the permission to check |
@@ -56,8 +56,7 @@ |
||
| 56 | 56 | * @class AuthenticationInterface |
| 57 | 57 | * @package Platine\Framework\Auth |
| 58 | 58 | */ |
| 59 | -interface AuthenticationInterface |
|
| 60 | -{ |
|
| 59 | +interface AuthenticationInterface { |
|
| 61 | 60 | /** |
| 62 | 61 | * Authenticate the user |
| 63 | 62 | * @param array<string, mixed> $credentials |
@@ -69,8 +69,7 @@ |
||
| 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 | * The JWT instance |
| 76 | 75 | * @var JWT |
@@ -248,12 +248,12 @@ discard block |
||
| 248 | 248 | $tokenExpire = time() + $expire; |
| 249 | 249 | $refreshTokenExpire = time() + $refreshExpire; |
| 250 | 250 | $this->jwt->setSecret($secret) |
| 251 | - ->setPayload([ |
|
| 252 | - 'sub' => $user->id, |
|
| 253 | - 'exp' => $tokenExpire, |
|
| 254 | - 'permissions' => $permissions, |
|
| 255 | - ]) |
|
| 256 | - ->sign(); |
|
| 251 | + ->setPayload([ |
|
| 252 | + 'sub' => $user->id, |
|
| 253 | + 'exp' => $tokenExpire, |
|
| 254 | + 'permissions' => $permissions, |
|
| 255 | + ]) |
|
| 256 | + ->sign(); |
|
| 257 | 257 | $refreshToken = bin2hex(random_bytes(20)); |
| 258 | 258 | $jwtToken = $this->jwt->getToken(); |
| 259 | 259 | |
@@ -267,16 +267,16 @@ discard block |
||
| 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 | 'email' => $user->email, |
| 276 | 276 | 'permissions' => $permissions, |
| 277 | - ], |
|
| 278 | - 'token' => $jwtToken, |
|
| 279 | - 'refresh_token' => $refreshToken, |
|
| 277 | + ], |
|
| 278 | + 'token' => $jwtToken, |
|
| 279 | + 'refresh_token' => $refreshToken, |
|
| 280 | 280 | ]; |
| 281 | 281 | |
| 282 | 282 | return array_merge($data, $this->getUserData($user, $token)); |
@@ -63,8 +63,7 @@ |
||
| 63 | 63 | * class SessionAuthentication |
| 64 | 64 | * @package Platine\Framework\Auth\Authentication |
| 65 | 65 | */ |
| 66 | -class SessionAuthentication implements AuthenticationInterface |
|
| 67 | -{ |
|
| 66 | +class SessionAuthentication implements AuthenticationInterface { |
|
| 68 | 67 | /** |
| 69 | 68 | * The session instance to use |
| 70 | 69 | * @var Session |
@@ -185,11 +185,11 @@ |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $data = [ |
| 188 | - 'id' => $user->id, |
|
| 189 | - 'username' => $user->username, |
|
| 190 | - 'lastname' => $user->lastname, |
|
| 191 | - 'firstname' => $user->firstname, |
|
| 192 | - 'permissions' => array_unique($permissions), |
|
| 188 | + 'id' => $user->id, |
|
| 189 | + 'username' => $user->username, |
|
| 190 | + 'lastname' => $user->lastname, |
|
| 191 | + 'firstname' => $user->firstname, |
|
| 192 | + 'permissions' => array_unique($permissions), |
|
| 193 | 193 | ]; |
| 194 | 194 | |
| 195 | 195 | $this->session->set('user', array_merge($data, $this->getUserData($user))); |
@@ -54,8 +54,7 @@ |
||
| 54 | 54 | * class SessionAuthorization |
| 55 | 55 | * @package Platine\Framework\Auth\Authorization |
| 56 | 56 | */ |
| 57 | -class SessionAuthorization implements AuthorizationInterface |
|
| 58 | -{ |
|
| 57 | +class SessionAuthorization implements AuthorizationInterface { |
|
| 59 | 58 | /** |
| 60 | 59 | * The session instance to use |
| 61 | 60 | * @var Session |
@@ -57,8 +57,7 @@ |
||
| 57 | 57 | * @class ApiAuthenticationInterface |
| 58 | 58 | * @package Platine\Framework\Auth |
| 59 | 59 | */ |
| 60 | -interface ApiAuthenticationInterface |
|
| 61 | -{ |
|
| 60 | +interface ApiAuthenticationInterface { |
|
| 62 | 61 | /** |
| 63 | 62 | * Whether the request is authenticated |
| 64 | 63 | * @param ServerRequestInterface $request |
@@ -66,19 +66,19 @@ |
||
| 66 | 66 | 'date' => 'date', |
| 67 | 67 | ]); |
| 68 | 68 | |
| 69 | - $mapper->filter('start_date', function (Query $q, $value) { |
|
| 69 | + $mapper->filter('start_date', function(Query $q, $value) { |
|
| 70 | 70 | $q->where('date')->gte($value); |
| 71 | 71 | }); |
| 72 | 72 | |
| 73 | - $mapper->filter('end_date', function (Query $q, $value) { |
|
| 73 | + $mapper->filter('end_date', function(Query $q, $value) { |
|
| 74 | 74 | $q->where('date')->lte($value); |
| 75 | 75 | }); |
| 76 | 76 | |
| 77 | - $mapper->filter('event', function (Query $q, $value) { |
|
| 77 | + $mapper->filter('event', function(Query $q, $value) { |
|
| 78 | 78 | $q->where('event')->is($value); |
| 79 | 79 | }); |
| 80 | 80 | |
| 81 | - $mapper->filter('user', function (Query $q, $value) { |
|
| 81 | + $mapper->filter('user', function(Query $q, $value) { |
|
| 82 | 82 | $q->where('user_id')->is($value); |
| 83 | 83 | }); |
| 84 | 84 | } |
@@ -57,8 +57,7 @@ |
||
| 57 | 57 | * @package Platine\Framework\Audit\Model |
| 58 | 58 | * @extends Entity<Audit> |
| 59 | 59 | */ |
| 60 | -class Audit extends Entity |
|
| 61 | -{ |
|
| 60 | +class Audit extends Entity { |
|
| 62 | 61 | /** |
| 63 | 62 | * |
| 64 | 63 | * @param EntityMapperInterface<Audit> $mapper |
@@ -59,8 +59,7 @@ |
||
| 59 | 59 | * @class Auditor |
| 60 | 60 | * @package Platine\Framework\Audit |
| 61 | 61 | */ |
| 62 | -class Auditor |
|
| 63 | -{ |
|
| 62 | +class Auditor { |
|
| 64 | 63 | /** |
| 65 | 64 | * The audit repository |
| 66 | 65 | * @var AuditRepository |