@@ -41,8 +41,7 @@ |
||
| 41 | 41 | * @class RestErrorHandler |
| 42 | 42 | * @package Platine\Framework\Handler\Error |
| 43 | 43 | */ |
| 44 | -class RestErrorHandler extends ErrorHandler |
|
| 45 | -{ |
|
| 44 | +class RestErrorHandler extends ErrorHandler { |
|
| 46 | 45 | /** |
| 47 | 46 | * {@inheritodc} |
| 48 | 47 | */ |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | * Return the validation max file size rules of attachment upload |
| 446 | 446 | * @return int|string |
| 447 | 447 | */ |
| 448 | - protected function getAttachmentMaxSize(): int|string |
|
| 448 | + protected function getAttachmentMaxSize(): int | string |
|
| 449 | 449 | { |
| 450 | 450 | return '2M'; |
| 451 | 451 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | * Return the image max file size value |
| 455 | 455 | * @return int|string |
| 456 | 456 | */ |
| 457 | - protected function getImageMaxSize(): int|string |
|
| 457 | + protected function getImageMaxSize(): int | string |
|
| 458 | 458 | { |
| 459 | 459 | return '1M'; |
| 460 | 460 | } |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * @package Platine\Framework\Helper |
| 53 | 53 | * @template T |
| 54 | 54 | */ |
| 55 | -class FileHelper |
|
| 56 | -{ |
|
| 55 | +class FileHelper { |
|
| 57 | 56 | /** |
| 58 | 57 | * |
| 59 | 58 | * @param Config<T> $config |
@@ -410,10 +410,10 @@ discard block |
||
| 410 | 410 | array $extras = [] |
| 411 | 411 | ): self { |
| 412 | 412 | $this->fields[$field] = [ |
| 413 | - 'type' => $type, |
|
| 414 | - 'title' => $title, |
|
| 415 | - 'value' => $default, |
|
| 416 | - 'extras' => $extras, |
|
| 413 | + 'type' => $type, |
|
| 414 | + 'title' => $title, |
|
| 415 | + 'value' => $default, |
|
| 416 | + 'extras' => $extras, |
|
| 417 | 417 | ]; |
| 418 | 418 | |
| 419 | 419 | return $this; |
@@ -438,11 +438,11 @@ discard block |
||
| 438 | 438 | array $extras = [] |
| 439 | 439 | ): self { |
| 440 | 440 | $this->fields[$field] = [ |
| 441 | - 'type' => $type, |
|
| 442 | - 'title' => $title, |
|
| 443 | - 'values' => $values, |
|
| 444 | - 'value' => $default, |
|
| 445 | - 'extras' => $extras, |
|
| 441 | + 'type' => $type, |
|
| 442 | + 'title' => $title, |
|
| 443 | + 'values' => $values, |
|
| 444 | + 'value' => $default, |
|
| 445 | + 'extras' => $extras, |
|
| 446 | 446 | ]; |
| 447 | 447 | |
| 448 | 448 | return $this; |
@@ -42,8 +42,7 @@ discard block |
||
| 42 | 42 | * @class Filter |
| 43 | 43 | * @package Platine\Framework\Helper |
| 44 | 44 | */ |
| 45 | -class Filter |
|
| 46 | -{ |
|
| 45 | +class Filter { |
|
| 47 | 46 | /** |
| 48 | 47 | * The filter fields |
| 49 | 48 | * @var array<string, array<string, mixed>> |
@@ -84,8 +83,7 @@ discard block |
||
| 84 | 83 | * Create new instance |
| 85 | 84 | * @param Lang $lang |
| 86 | 85 | */ |
| 87 | - public function __construct(protected Lang $lang) |
|
| 88 | - { |
|
| 86 | + public function __construct(protected Lang $lang) { |
|
| 89 | 87 | if ($this->autoConfigure) { |
| 90 | 88 | $this->configure(); |
| 91 | 89 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param float|int $amount |
| 96 | 96 | * @return string |
| 97 | 97 | */ |
| 98 | - public static function numberToString(float|int $amount): string |
|
| 98 | + public static function numberToString(float | int $amount): string |
|
| 99 | 99 | { |
| 100 | 100 | $value = (string) $amount; |
| 101 | 101 | if (stripos($value, 'e') !== false) { |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | return $value; |
| 120 | 120 | } |
| 121 | 121 | list($base, $decimal) = explode('E', str_replace('e', 'E', $value)); |
| 122 | - $exponent = (int)$decimal; |
|
| 122 | + $exponent = (int) $decimal; |
|
| 123 | 123 | if ($exponent >= 0) { |
| 124 | 124 | // Positive exponent: add zeros to the right |
| 125 | 125 | $parts = explode('.', $base); |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | * @class NumberHelper |
| 38 | 38 | * @package Platine\Framework\Helper |
| 39 | 39 | */ |
| 40 | -class NumberHelper |
|
| 41 | -{ |
|
| 40 | +class NumberHelper { |
|
| 42 | 41 | /** |
| 43 | 42 | * Float comparison delta value |
| 44 | 43 | */ |
@@ -147,7 +146,8 @@ discard block |
||
| 147 | 146 | $fullNumber = $integerPart . $decimalPart; |
| 148 | 147 | $numZeros = $absExponent - strlen($integerPart); |
| 149 | 148 | // @codeCoverageIgnoreStart |
| 150 | - if ($numZeros < 0) { // Exponent is smaller than integer part length |
|
| 149 | + if ($numZeros < 0) { |
|
| 150 | +// Exponent is smaller than integer part length |
|
| 151 | 151 | $insertPoint = strlen($integerPart) + $exponent; // Exponent is negative |
| 152 | 152 | return sprintf( |
| 153 | 153 | '%s.%s', |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | public static function createTree( |
| 51 | 51 | array $elements, |
| 52 | - string|int|null $parentId = 0, |
|
| 52 | + string | int | null $parentId = 0, |
|
| 53 | 53 | string $idField = 'id', |
| 54 | 54 | string $parentField = 'parent_id' |
| 55 | 55 | ): array { |
@@ -37,8 +37,7 @@ |
||
| 37 | 37 | * @class TreeHelper |
| 38 | 38 | * @package Platine\Framework\Helper |
| 39 | 39 | */ |
| 40 | -class TreeHelper |
|
| 41 | -{ |
|
| 40 | +class TreeHelper { |
|
| 42 | 41 | /** |
| 43 | 42 | * Create tree |
| 44 | 43 | * @param array<mixed> $elements |
@@ -47,8 +47,7 @@ |
||
| 47 | 47 | * @package Platine\Framework\Helper |
| 48 | 48 | * @template T |
| 49 | 49 | */ |
| 50 | -class Sidebar |
|
| 51 | -{ |
|
| 50 | +class Sidebar { |
|
| 52 | 51 | /** |
| 53 | 52 | * The sidebar data |
| 54 | 53 | * @var array<string, array<int, array<string, mixed>>> |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | ]; |
| 119 | 119 | |
| 120 | 120 | if ($type & self::CREATE) { |
| 121 | - $mapper->on('save', function ( |
|
| 121 | + $mapper->on('save', function( |
|
| 122 | 122 | Entity $entity, |
| 123 | 123 | DataMapper $dm |
| 124 | 124 | ) use ( |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if ($type & self::UPDATE) { |
| 148 | - $mapper->on('update', function ( |
|
| 148 | + $mapper->on('update', function( |
|
| 149 | 149 | Entity $entity, |
| 150 | 150 | DataMapper $dm |
| 151 | 151 | ) use ( |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | if ($type & self::DELETE) { |
| 175 | - $mapper->on('delete', function ( |
|
| 175 | + $mapper->on('delete', function( |
|
| 176 | 176 | Entity $entity, |
| 177 | 177 | DataMapper $dm |
| 178 | 178 | ) use ( |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | $results = []; |
| 224 | 224 | |
| 225 | 225 | // Closure to set entity relation data |
| 226 | - $setRelation = function (Entity $e, array|string $relation): string { |
|
| 226 | + $setRelation = function(Entity $e, array | string $relation): string { |
|
| 227 | 227 | $relation = Arr::wrap($relation); |
| 228 | 228 | $text = []; |
| 229 | 229 | foreach ($relation as $val) { |
| 230 | - $text[] = $e->{$val}; |
|
| 230 | + $text[] = $e->{$val}; |
|
| 231 | 231 | } |
| 232 | 232 | return Arr::toString($text, ' '); |
| 233 | 233 | }; |
@@ -48,8 +48,7 @@ |
||
| 48 | 48 | * @package Platine\Framework\Helper |
| 49 | 49 | * @template TEntity as Entity |
| 50 | 50 | */ |
| 51 | -class EntityHelper |
|
| 52 | -{ |
|
| 51 | +class EntityHelper { |
|
| 53 | 52 | public const NONE = 0; |
| 54 | 53 | public const DELETE = 1; |
| 55 | 54 | public const CREATE = 2; |
@@ -41,8 +41,7 @@ |
||
| 41 | 41 | * @template T |
| 42 | 42 | * @implements ArrayAccess<string, mixed> |
| 43 | 43 | */ |
| 44 | -class ViewContext implements ArrayAccess |
|
| 45 | -{ |
|
| 44 | +class ViewContext implements ArrayAccess { |
|
| 46 | 45 | /** |
| 47 | 46 | * The context data |
| 48 | 47 | * @var array<string, mixed> |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | * @return bool |
| 75 | 75 | */ |
| 76 | 76 | public function sendReportMail( |
| 77 | - int|string $reportId, |
|
| 77 | + int | string $reportId, |
|
| 78 | 78 | string $object, |
| 79 | - string|array $receiverAddress, |
|
| 79 | + string | array $receiverAddress, |
|
| 80 | 80 | array $data = [], |
| 81 | 81 | array $attachments = [], |
| 82 | 82 | string $senderAddress = '', |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | * @return bool |
| 112 | 112 | */ |
| 113 | 113 | public function sendMail( |
| 114 | - int|string $reportId, |
|
| 114 | + int | string $reportId, |
|
| 115 | 115 | string $content, |
| 116 | 116 | string $object, |
| 117 | - string|array $receiverAddress, |
|
| 117 | + string | array $receiverAddress, |
|
| 118 | 118 | array $data = [], |
| 119 | 119 | array $attachments = [], |
| 120 | 120 | string $senderAddress = '', |
@@ -45,8 +45,7 @@ |
||
| 45 | 45 | * @package Platine\Framework\Helper |
| 46 | 46 | * @template T |
| 47 | 47 | */ |
| 48 | -class MailHelper |
|
| 49 | -{ |
|
| 48 | +class MailHelper { |
|
| 50 | 49 | /** |
| 51 | 50 | * Create new instance |
| 52 | 51 | * @param Template $template |