@@ -87,7 +87,7 @@ |
||
| 87 | 87 | ?CsrfStorageInterface $storage = null |
| 88 | 88 | ) { |
| 89 | 89 | $this->config = $config; |
| 90 | - $this->storage = $storage ?? new CsrfNullStorage(); |
|
| 90 | + $this->storage = $storage ?? new CsrfNullStorage(); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | * @package Platine\Framework\Security\Csrf |
| 60 | 60 | * @template T |
| 61 | 61 | */ |
| 62 | -class CsrfManager |
|
| 63 | -{ |
|
| 62 | +class CsrfManager { |
|
| 64 | 63 | /** |
| 65 | 64 | * The application configuration class |
| 66 | 65 | * @var Config<T> |
@@ -188,8 +187,7 @@ discard block |
||
| 188 | 187 | * @param string $key |
| 189 | 188 | * @return mixed |
| 190 | 189 | */ |
| 191 | - private function getConfigValue(string $key) |
|
| 192 | - { |
|
| 190 | + private function getConfigValue(string $key) { |
|
| 193 | 191 | $config = $this->config->get('security.csrf', []); |
| 194 | 192 | |
| 195 | 193 | return $config[$key] ?? null; |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | * @class CsrfStorageInterface |
| 52 | 52 | * @package Platine\Framework\Security\Csrf |
| 53 | 53 | */ |
| 54 | -interface CsrfStorageInterface |
|
| 55 | -{ |
|
| 54 | +interface CsrfStorageInterface { |
|
| 56 | 55 | /** |
| 57 | 56 | * Return the token information from storage |
| 58 | 57 | * @param string $name |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * @class CsrfSessionStorage |
| 55 | 55 | * @package Platine\Framework\Security\Csrf\Storage |
| 56 | 56 | */ |
| 57 | -class CsrfSessionStorage implements CsrfStorageInterface |
|
| 58 | -{ |
|
| 57 | +class CsrfSessionStorage implements CsrfStorageInterface { |
|
| 59 | 58 | /** |
| 60 | 59 | * The session key used to store CSRF data |
| 61 | 60 | */ |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | * Create new instance |
| 73 | 72 | * @param Session $session |
| 74 | 73 | */ |
| 75 | - public function __construct(Session $session) |
|
| 76 | - { |
|
| 74 | + public function __construct(Session $session) { |
|
| 77 | 75 | $this->session = $session; |
| 78 | 76 | } |
| 79 | 77 | |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | */ |
| 75 | 75 | public function set(string $name, string $token, int $expire): void |
| 76 | 76 | { |
| 77 | - $this->data[$name] = $token; |
|
| 77 | + $this->data[$name] = $token; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -53,8 +53,7 @@ |
||
| 53 | 53 | * @class CsrfNullStorage |
| 54 | 54 | * @package Platine\Framework\Security\Csrf\Storage |
| 55 | 55 | */ |
| 56 | -class CsrfNullStorage implements CsrfStorageInterface |
|
| 57 | -{ |
|
| 56 | +class CsrfNullStorage implements CsrfStorageInterface { |
|
| 58 | 57 | /** |
| 59 | 58 | * The CSRF data |
| 60 | 59 | * @var array<string, string> |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | * @class CsrfUserSessionStorage |
| 52 | 52 | * @package Platine\Framework\Security\Csrf\Storage |
| 53 | 53 | */ |
| 54 | -class CsrfUserSessionStorage extends CsrfSessionStorage |
|
| 55 | -{ |
|
| 54 | +class CsrfUserSessionStorage extends CsrfSessionStorage { |
|
| 56 | 55 | /** |
| 57 | 56 | * {@inheritdoc} |
| 58 | 57 | */ |
@@ -59,14 +59,12 @@ discard block |
||
| 59 | 59 | * @package Platine\Framework\Form\Param |
| 60 | 60 | * @template TEntity as Entity |
| 61 | 61 | */ |
| 62 | -class BaseParam implements JsonSerializable |
|
| 63 | -{ |
|
| 62 | +class BaseParam implements JsonSerializable { |
|
| 64 | 63 | /** |
| 65 | 64 | * Create new instance |
| 66 | 65 | * @param array<string, mixed> $data |
| 67 | 66 | */ |
| 68 | - public function __construct(array $data = []) |
|
| 69 | - { |
|
| 67 | + public function __construct(array $data = []) { |
|
| 70 | 68 | // Load default values |
| 71 | 69 | $this->loadDefaultValues(); |
| 72 | 70 | |
@@ -126,8 +124,7 @@ discard block |
||
| 126 | 124 | * Convert parameter to JSON array |
| 127 | 125 | * @return array<string, mixed> |
| 128 | 126 | */ |
| 129 | - public function jsonSerialize() |
|
| 130 | - { |
|
| 127 | + public function jsonSerialize() { |
|
| 131 | 128 | return $this->data(); |
| 132 | 129 | } |
| 133 | 130 | |
@@ -136,8 +133,7 @@ discard block |
||
| 136 | 133 | * @param string $name |
| 137 | 134 | * @return mixed|null |
| 138 | 135 | */ |
| 139 | - public function __get($name) |
|
| 140 | - { |
|
| 136 | + public function __get($name) { |
|
| 141 | 137 | if (property_exists($this, $name)) { |
| 142 | 138 | return $this->{$name}; |
| 143 | 139 | } |
@@ -157,8 +153,7 @@ discard block |
||
| 157 | 153 | * @param mixed $value |
| 158 | 154 | * @return mixed |
| 159 | 155 | */ |
| 160 | - protected function getPropertyValue(string $attribute, $value) |
|
| 161 | - { |
|
| 156 | + protected function getPropertyValue(string $attribute, $value) { |
|
| 162 | 157 | $types = $this->getPropertyTypes(); |
| 163 | 158 | $property = $types[$attribute] ?? null; |
| 164 | 159 | if ($property === null) { |
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | * @package Platine\Framework\Http\Maintenance\Driver |
| 56 | 56 | * @template T |
| 57 | 57 | */ |
| 58 | -class FileMaintenanceDriver implements MaintenanceDriverInterface |
|
| 59 | -{ |
|
| 58 | +class FileMaintenanceDriver implements MaintenanceDriverInterface { |
|
| 60 | 59 | /** |
| 61 | 60 | * The application configuration |
| 62 | 61 | * @var Config<T> |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | * @param Config<T> $config |
| 75 | 74 | * @param Filesystem $filesystem |
| 76 | 75 | */ |
| 77 | - public function __construct(Config $config, Filesystem $filesystem) |
|
| 78 | - { |
|
| 76 | + public function __construct(Config $config, Filesystem $filesystem) { |
|
| 79 | 77 | $this->config = $config; |
| 80 | 78 | $this->filesystem = $filesystem; |
| 81 | 79 | } |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | * @class MaintenanceDriverInterface |
| 52 | 52 | * @package Platine\Framework\Http\Maintenance |
| 53 | 53 | */ |
| 54 | -interface MaintenanceDriverInterface |
|
| 55 | -{ |
|
| 54 | +interface MaintenanceDriverInterface { |
|
| 56 | 55 | /** |
| 57 | 56 | * Whether the maintenance is active or not |
| 58 | 57 | * @return bool |
@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | * @package Platine\Framework\Console\Command |
| 59 | 59 | * @template T |
| 60 | 60 | */ |
| 61 | -class MaintenanceCommand extends Command |
|
| 62 | -{ |
|
| 61 | +class MaintenanceCommand extends Command { |
|
| 63 | 62 | /** |
| 64 | 63 | * The configuration to use |
| 65 | 64 | * @var Config<T> |
@@ -173,8 +172,7 @@ discard block |
||
| 173 | 172 | /** |
| 174 | 173 | * {@inheritdoc} |
| 175 | 174 | */ |
| 176 | - public function execute() |
|
| 177 | - { |
|
| 175 | + public function execute() { |
|
| 178 | 176 | $type = $this->getArgumentValue('type'); |
| 179 | 177 | |
| 180 | 178 | $io = $this->io(); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $this->config = $config; |
| 86 | 86 | |
| 87 | 87 | $this->setName('maintenance') |
| 88 | - ->setDescription('Command to manage application maintenance'); |
|
| 88 | + ->setDescription('Command to manage application maintenance'); |
|
| 89 | 89 | |
| 90 | 90 | $this->addArgument('type', 'type of action [up|down|status]', 'status', true, true, false, function ($val) { |
| 91 | 91 | if (!in_array($val, ['up', 'down', 'status'])) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | )); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - return $val; |
|
| 98 | + return $val; |
|
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | 101 | $this->addOption( |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $this->setName('maintenance') |
| 88 | 88 | ->setDescription('Command to manage application maintenance'); |
| 89 | 89 | |
| 90 | - $this->addArgument('type', 'type of action [up|down|status]', 'status', true, true, false, function ($val) { |
|
| 90 | + $this->addArgument('type', 'type of action [up|down|status]', 'status', true, true, false, function($val) { |
|
| 91 | 91 | if (!in_array($val, ['up', 'down', 'status'])) { |
| 92 | 92 | throw new RuntimeException(sprintf( |
| 93 | 93 | 'Invalid argument type [%s], must be one of [up, down, status]', |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | false, |
| 114 | 114 | true, |
| 115 | 115 | false, |
| 116 | - function ($val) { |
|
| 116 | + function($val) { |
|
| 117 | 117 | if (strlen($val) > 0 && (!is_numeric($val) || (int) $val <= 0)) { |
| 118 | 118 | throw new RuntimeException(sprintf( |
| 119 | 119 | 'Invalid retry value [%s], must be an integer greather than zero', |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | false, |
| 132 | 132 | true, |
| 133 | 133 | false, |
| 134 | - function ($val) { |
|
| 134 | + function($val) { |
|
| 135 | 135 | if (strlen($val) > 0 && (!is_numeric($val) || (int) $val <= 0)) { |
| 136 | 136 | throw new RuntimeException(sprintf( |
| 137 | 137 | 'Invalid refresh value [%s], must be an integer greather than zero', |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | false, |
| 157 | 157 | true, |
| 158 | 158 | false, |
| 159 | - function ($val) { |
|
| 159 | + function($val) { |
|
| 160 | 160 | if (strlen($val) > 0 && (!is_numeric($val) || (int) $val < 200 || (int) $val > 505)) { |
| 161 | 161 | throw new RuntimeException(sprintf( |
| 162 | 162 | 'Invalid HTTP status value [%s], must be between 200 and 505', |