Test Failed
Push — develop ( a061b1...df8064 )
by nguereza
02:52
created
src/Auth/Middleware/ApiAuthenticationMiddleware.php 1 patch
Braces   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@  discard block
 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
      * The Authentication instance
68 67
      * @var ApiAuthenticationInterface
@@ -83,7 +82,7 @@  discard block
 block discarded – undo
83 82
     public function __construct(
84 83
         ApiAuthenticationInterface $authentication,
85 84
         Config $config
86
-    ) {
85
+    ) {
87 86
         $this->authentication = $authentication;
88 87
         $this->config = $config;
89 88
     }
@@ -95,11 +94,11 @@  discard block
 block discarded – undo
95 94
         ServerRequestInterface $request,
96 95
         RequestHandlerInterface $handler
97 96
     ): ResponseInterface {
98
-        if (!$this->shouldBeProcessed($request)) {
97
+        if (!$this->shouldBeProcessed($request)) {
99 98
             return $handler->handle($request);
100 99
         }
101 100
 
102
-        if (!$this->authentication->isAuthenticated($request)) {
101
+        if (!$this->authentication->isAuthenticated($request)) {
103 102
             return $this->unauthorizedResponse();
104 103
         }
105 104
 
@@ -116,19 +115,19 @@  discard block
 block discarded – undo
116 115
         //If no route has been match no need check for authentication
117 116
         /** @var ?Route $route */
118 117
         $route = $request->getAttribute(Route::class);
119
-        if (!$route) {
118
+        if (!$route) {
120 119
             return false;
121 120
         }
122 121
 
123 122
         //Check if the path match
124 123
         $path = $this->config->get('api.auth.path', '/');
125
-        if (!preg_match('~^' . $path . '~', $route->getPattern())) {
124
+        if (!preg_match('~^' . $path . '~', $route->getPattern())) {
126 125
             return false;
127 126
         }
128 127
 
129 128
         //check if is url whitelist
130 129
         $urls = $this->config->get('api.auth.url_whitelist', []);
131
-        if (in_array($route->getName(), $urls)) {
130
+        if (in_array($route->getName(), $urls)) {
132 131
             return false;
133 132
         }
134 133
 
Please login to merge, or discard this patch.
src/Auth/Middleware/AuthenticationMiddleware.php 1 patch
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@  discard block
 block discarded – undo
62 62
  * @package Platine\Framework\Auth\Middleware
63 63
  * @template T
64 64
  */
65
-class AuthenticationMiddleware implements MiddlewareInterface
66
-{
65
+class AuthenticationMiddleware implements MiddlewareInterface {
67 66
     /**
68 67
      * The Authentication instance
69 68
      * @var AuthenticationInterface
@@ -92,7 +91,7 @@  discard block
 block discarded – undo
92 91
         AuthenticationInterface $authentication,
93 92
         Config $config,
94 93
         RouteHelper $routeHelper
95
-    ) {
94
+    ) {
96 95
         $this->authentication = $authentication;
97 96
         $this->config = $config;
98 97
         $this->routeHelper = $routeHelper;
@@ -105,11 +104,11 @@  discard block
 block discarded – undo
105 104
         ServerRequestInterface $request,
106 105
         RequestHandlerInterface $handler
107 106
     ): ResponseInterface {
108
-        if (!$this->shouldBeProcessed($request)) {
107
+        if (!$this->shouldBeProcessed($request)) {
109 108
             return $handler->handle($request);
110 109
         }
111 110
 
112
-        if (!$this->authentication->isLogged()) {
111
+        if (!$this->authentication->isLogged()) {
113 112
             $authRoute = $this->config->get('auth.authentication.login_route');
114 113
             $next = $request->getUri()->getPath();
115 114
             return new RedirectResponse(
@@ -130,13 +129,13 @@  discard block
 block discarded – undo
130 129
         //If no route has been match no need check for authentication
131 130
         /** @var ?Route $route */
132 131
         $route = $request->getAttribute(Route::class);
133
-        if (!$route) {
132
+        if (!$route) {
134 133
             return false;
135 134
         }
136 135
 
137 136
         //check if is url whitelist
138 137
         $urls = $this->config->get('auth.authentication.url_whitelist', []);
139
-        if (in_array($route->getName(), $urls)) {
138
+        if (in_array($route->getName(), $urls)) {
140 139
             return false;
141 140
         }
142 141
 
Please login to merge, or discard this patch.
src/Auth/Exception/AccountLockedException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,6 +37,5 @@
 block discarded – undo
37 37
  * @class AccountLockedException
38 38
  * @package Platine\Framework\Auth\Exception
39 39
  */
40
-class AccountLockedException extends AuthenticationException
41
-{
40
+class AccountLockedException extends AuthenticationException {
42 41
 }
Please login to merge, or discard this patch.
src/Auth/Exception/MissingCredentialsException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,6 +37,5 @@
 block discarded – undo
37 37
  * @class MissingCredentialsException
38 38
  * @package Platine\Framework\Auth\Exception
39 39
  */
40
-class MissingCredentialsException extends AuthenticationException
41
-{
40
+class MissingCredentialsException extends AuthenticationException {
42 41
 }
Please login to merge, or discard this patch.
src/Auth/Exception/AuthenticationException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,6 +39,5 @@
 block discarded – undo
39 39
  * @class AuthenticationException
40 40
  * @package Platine\Framework\Auth\Exception
41 41
  */
42
-class AuthenticationException extends Exception
43
-{
42
+class AuthenticationException extends Exception {
44 43
 }
Please login to merge, or discard this patch.
src/Auth/Exception/InvalidCredentialsException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,6 +37,5 @@
 block discarded – undo
37 37
  * @class InvalidCredentialsException
38 38
  * @package Platine\Framework\Auth\Exception
39 39
  */
40
-class InvalidCredentialsException extends AuthenticationException
41
-{
40
+class InvalidCredentialsException extends AuthenticationException {
42 41
 }
Please login to merge, or discard this patch.
src/Auth/Exception/AccountNotFoundException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,6 +37,5 @@
 block discarded – undo
37 37
  * @class AccountNotFoundException
38 38
  * @package Platine\Framework\Auth\Exception
39 39
  */
40
-class AccountNotFoundException extends AuthenticationException
41
-{
40
+class AccountNotFoundException extends AuthenticationException {
42 41
 }
Please login to merge, or discard this patch.
src/Auth/Event/AuthInvalidPasswordEvent.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@  discard block
 block discarded – undo
54 54
  * @class AuthInvalidPasswordEvent
55 55
  * @package Platine\Framework\Auth\Event
56 56
  */
57
-class AuthInvalidPasswordEvent extends Event
58
-{
57
+class AuthInvalidPasswordEvent extends Event {
59 58
     /**
60 59
      * The authentication user
61 60
      * @var User
@@ -66,8 +65,7 @@  discard block
 block discarded – undo
66 65
      * Create new instance
67 66
      * @param User $user
68 67
      */
69
-    public function __construct(User $user)
70
-    {
68
+    public function __construct(User $user) {
71 69
         parent::__construct(__CLASS__, []);
72 70
         $this->user = $user;
73 71
     }
Please login to merge, or discard this patch.
src/Auth/Event/AuthLoginEvent.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@  discard block
 block discarded – undo
54 54
  * @class AuthLoginEvent
55 55
  * @package Platine\Framework\Auth\Event
56 56
  */
57
-class AuthLoginEvent extends Event
58
-{
57
+class AuthLoginEvent extends Event {
59 58
     /**
60 59
      * The authentication user
61 60
      * @var User
@@ -66,8 +65,7 @@  discard block
 block discarded – undo
66 65
      * Create new instance
67 66
      * @param User $user
68 67
      */
69
-    public function __construct(User $user)
70
-    {
68
+    public function __construct(User $user) {
71 69
         parent::__construct(__CLASS__, []);
72 70
         $this->user = $user;
73 71
     }
Please login to merge, or discard this patch.