@@ -164,7 +164,7 @@ |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | if (!$this->hasParser($contentType)) { |
| 167 | - // If not, look for a media type with a structured syntax suffix (RFC 6839) |
|
| 167 | + // If not, look for a media type with a structured syntax suffix (RFC 6839) |
|
| 168 | 168 | $parts = explode('+', $contentType); |
| 169 | 169 | |
| 170 | 170 | if (count($parts) >= 2) { |
@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | * @class BodyParserMiddleware |
| 59 | 59 | * @package Platine\Framework\Http\Middleware |
| 60 | 60 | */ |
| 61 | -class BodyParserMiddleware implements MiddlewareInterface |
|
| 62 | -{ |
|
| 61 | +class BodyParserMiddleware implements MiddlewareInterface { |
|
| 63 | 62 | |
| 64 | 63 | /** |
| 65 | 64 | * List of body parser to use |
@@ -70,8 +69,7 @@ discard block |
||
| 70 | 69 | /** |
| 71 | 70 | * Create new instance |
| 72 | 71 | */ |
| 73 | - public function __construct() |
|
| 74 | - { |
|
| 72 | + public function __construct() { |
|
| 75 | 73 | $this->registerDefaultParsers(); |
| 76 | 74 | } |
| 77 | 75 | |
@@ -156,8 +154,7 @@ discard block |
||
| 156 | 154 | * @param ServerRequestInterface $request |
| 157 | 155 | * @return null|array<mixed>|object |
| 158 | 156 | */ |
| 159 | - protected function parseBody(ServerRequestInterface $request) |
|
| 160 | - { |
|
| 157 | + protected function parseBody(ServerRequestInterface $request) { |
|
| 161 | 158 | $contentType = $this->getRequestContentType($request); |
| 162 | 159 | if ($contentType === null) { |
| 163 | 160 | return null; |
@@ -128,7 +128,7 @@ discard block |
||
| 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 |
||
| 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; |