@@ -58,8 +58,7 @@ |
||
58 | 58 | * @class HttpStatus |
59 | 59 | * @package Platine\Framework\Http\Client |
60 | 60 | */ |
61 | -class HttpStatus |
|
62 | -{ |
|
61 | +class HttpStatus { |
|
63 | 62 | // Informational 1xx: |
64 | 63 | public const INFORMATIONAL = 100; |
65 | 64 | public const CONTINUE = 100; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | // Informational 1xx: |
64 | 64 | public const INFORMATIONAL = 100; |
65 | - public const CONTINUE = 100; |
|
65 | + public const continue = 100; |
|
66 | 66 | public const SWITCHING_PROTOCOLS = 101; |
67 | 67 | |
68 | 68 | // Successful 2xx: |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public const SERVER_ERROR_END = 600; |
119 | 119 | |
120 | 120 | public const REASON_PHRASES = [ |
121 | - self::CONTINUE => 'Continue', |
|
121 | + self::continue => 'Continue', |
|
122 | 122 | self::SWITCHING_PROTOCOLS => 'Switching Protocols', |
123 | 123 | |
124 | 124 | self::OK => 'OK', |
@@ -271,8 +271,8 @@ |
||
271 | 271 | */ |
272 | 272 | public function contentType(string $contentType): self |
273 | 273 | { |
274 | - // If this is a multipart request and boundary was not defined, |
|
275 | - // we define a boundary as this is required for multipart requests. |
|
274 | + // If this is a multipart request and boundary was not defined, |
|
275 | + // we define a boundary as this is required for multipart requests. |
|
276 | 276 | if (stripos($contentType, 'multipart/') !== false) { |
277 | 277 | if (stripos($contentType, 'boundary') === false) { |
278 | 278 | $contentType .= sprintf('; boundary="%s"', uniqid((string) time())); |
@@ -519,7 +519,7 @@ |
||
519 | 519 | protected function send($ch): HttpResponse |
520 | 520 | { |
521 | 521 | $responseHeaders = []; |
522 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$responseHeaders) { |
|
522 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$responseHeaders) { |
|
523 | 523 | if (strpos($header, ':') !== false) { |
524 | 524 | list($name, $value) = explode(':', $header); |
525 | 525 | if (array_key_exists($name, $responseHeaders) === false) { |
@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | * @class HttpClient |
57 | 57 | * @package Platine\Framework\Http\Client |
58 | 58 | */ |
59 | -class HttpClient |
|
60 | -{ |
|
59 | +class HttpClient { |
|
61 | 60 | /** |
62 | 61 | * The base URL |
63 | 62 | * @var string |
@@ -110,8 +109,7 @@ discard block |
||
110 | 109 | * Create new instance |
111 | 110 | * @param string $baseUrl |
112 | 111 | */ |
113 | - public function __construct(string $baseUrl = '') |
|
114 | - { |
|
112 | + public function __construct(string $baseUrl = '') { |
|
115 | 113 | $this->baseUrl = $baseUrl; |
116 | 114 | } |
117 | 115 |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class HttpMethod |
53 | 53 | * @package Platine\Framework\Http\Client |
54 | 54 | */ |
55 | -class HttpMethod |
|
56 | -{ |
|
55 | +class HttpMethod { |
|
57 | 56 | public const HEAD = 'HEAD'; |
58 | 57 | public const GET = 'GET'; |
59 | 58 | public const PUT = 'PUT'; |
@@ -183,7 +183,7 @@ |
||
183 | 183 | */ |
184 | 184 | protected function shouldBeProcessed(ServerRequestInterface $request): bool |
185 | 185 | { |
186 | - //If no route has been match no need check for CSRF |
|
186 | + //If no route has been match no need check for CSRF |
|
187 | 187 | /** @var ?Route $route */ |
188 | 188 | $route = $request->getAttribute(Route::class); |
189 | 189 | if (!$route) { |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | * @package Platine\Framework\Http\Middleware |
60 | 60 | * @template T |
61 | 61 | */ |
62 | -class SecurityPolicyMiddleware implements MiddlewareInterface |
|
63 | -{ |
|
62 | +class SecurityPolicyMiddleware implements MiddlewareInterface { |
|
64 | 63 | /** |
65 | 64 | * The SecurityPolicy instance |
66 | 65 | * @var SecurityPolicy<T> |
@@ -71,8 +70,7 @@ discard block |
||
71 | 70 | * Create new instance |
72 | 71 | * @param SecurityPolicy<T> $securityPolicy |
73 | 72 | */ |
74 | - public function __construct(SecurityPolicy $securityPolicy) |
|
75 | - { |
|
73 | + public function __construct(SecurityPolicy $securityPolicy) { |
|
76 | 74 | $this->securityPolicy = $securityPolicy; |
77 | 75 | } |
78 | 76 |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | return []; |
151 | 151 | } |
152 | 152 | |
153 | - $policy = new FeaturePermissionPolicy($config); |
|
153 | + $policy = new FeaturePermissionPolicy($config); |
|
154 | 154 | |
155 | 155 | return ['Permissions-Policy' => $policy->headers()]; |
156 | 156 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | return []; |
168 | 168 | } |
169 | 169 | |
170 | - $policy = new StrictTransportSecurityPolicy($config); |
|
170 | + $policy = new StrictTransportSecurityPolicy($config); |
|
171 | 171 | |
172 | 172 | return ['Strict-Transport-Security' => $policy->headers()]; |
173 | 173 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | return []; |
186 | 186 | } |
187 | 187 | |
188 | - $policy = new ClearSiteDataPolicy($config); |
|
188 | + $policy = new ClearSiteDataPolicy($config); |
|
189 | 189 | |
190 | 190 | return ['Clear-Site-Data' => $policy->headers()]; |
191 | 191 | } |
@@ -61,8 +61,7 @@ |
||
61 | 61 | * @package Platine\Framework\Security |
62 | 62 | * @template T |
63 | 63 | */ |
64 | -class SecurityPolicy |
|
65 | -{ |
|
64 | +class SecurityPolicy { |
|
66 | 65 | /** |
67 | 66 | * The application configuration |
68 | 67 | * @var Config<T> |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class StrictTransportSecurityPolicy |
53 | 53 | * @package Platine\Framework\Security\Policy |
54 | 54 | */ |
55 | -class StrictTransportSecurityPolicy extends AbstractPolicy |
|
56 | -{ |
|
55 | +class StrictTransportSecurityPolicy extends AbstractPolicy { |
|
57 | 56 | /** |
58 | 57 | * {@inheritdoc} |
59 | 58 | */ |
@@ -79,7 +79,7 @@ |
||
79 | 79 | $directives = array_intersect_key($config, $this->whitelist); |
80 | 80 | $values = array_filter($directives); |
81 | 81 | |
82 | - $results = array_map(function (string $directive) { |
|
82 | + $results = array_map(function(string $directive) { |
|
83 | 83 | if ($directive === 'execution-contexts') { |
84 | 84 | $directive = 'executionContexts'; |
85 | 85 | } |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class ClearSiteDataPolicy |
53 | 53 | * @package Platine\Framework\Security\Policy |
54 | 54 | */ |
55 | -class ClearSiteDataPolicy extends AbstractPolicy |
|
56 | -{ |
|
55 | +class ClearSiteDataPolicy extends AbstractPolicy { |
|
57 | 56 | /** |
58 | 57 | * Clear Site Data white list directives. |
59 | 58 | * @var array<string, bool> |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | * @class AbstractPolicy |
53 | 53 | * @package Platine\Framework\Security\Policy |
54 | 54 | */ |
55 | -abstract class AbstractPolicy |
|
56 | -{ |
|
55 | +abstract class AbstractPolicy { |
|
57 | 56 | /** |
58 | 57 | * The configuration |
59 | 58 | * @var array<string, mixed> |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | * Create new instance |
65 | 64 | * @param array<string, mixed> $configurations |
66 | 65 | */ |
67 | - public function __construct(array $configurations = []) |
|
68 | - { |
|
66 | + public function __construct(array $configurations = []) { |
|
69 | 67 | $this->configurations = $configurations; |
70 | 68 | } |
71 | 69 |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | $filtered = $this->filter($config, $whitelist); |
147 | 147 | |
148 | - return array_map(function (string $keyword) { |
|
148 | + return array_map(function(string $keyword) { |
|
149 | 149 | return sprintf('\'%s\'', $keyword); |
150 | 150 | }, $filtered); |
151 | 151 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function schemes(array $schemes): array |
159 | 159 | { |
160 | - return array_map(function (string $scheme) { |
|
160 | + return array_map(function(string $scheme) { |
|
161 | 161 | $clean = trim($scheme); |
162 | 162 | |
163 | 163 | if (substr($clean, -1) === ':') { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function nonces(array $nonces): array |
177 | 177 | { |
178 | - return array_map(function (string $nonce) { |
|
178 | + return array_map(function(string $nonce) { |
|
179 | 179 | $clean = trim($nonce); |
180 | 180 | |
181 | 181 | if (base64_decode($clean, true) === false) { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | { |
223 | 223 | $pluginTypes = $this->configurations['plugin-types'] ?? []; |
224 | 224 | |
225 | - $filtered = array_filter($pluginTypes, function (string $mime) { |
|
225 | + $filtered = array_filter($pluginTypes, function(string $mime) { |
|
226 | 226 | return preg_match('/^[a-z\-]+\/[a-z\-]+$/i', $mime); |
227 | 227 | }); |
228 | 228 |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class ContentSecurityPolicy |
53 | 53 | * @package Platine\Framework\Security\Policy |
54 | 54 | */ |
55 | -class ContentSecurityPolicy extends AbstractPolicy |
|
56 | -{ |
|
55 | +class ContentSecurityPolicy extends AbstractPolicy { |
|
57 | 56 | /** |
58 | 57 | * Content Security Policy white list directives. |
59 | 58 | * @var array<string, bool> |