@@ -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 |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | if ($reportDebugPath !== null) { |
171 | 171 | $reportDebugFile = sprintf('%s/%s.log', $reportDebugPath, $reportId); |
172 | 172 | $this->filesystem->file($reportDebugFile) |
173 | - ->write(Json::encode( |
|
174 | - $reportData, |
|
175 | - JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES |
|
176 | - )); |
|
173 | + ->write(Json::encode( |
|
174 | + $reportData, |
|
175 | + JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES |
|
176 | + )); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | $filepath = sprintf('%s/%s', $path, $filename); |
219 | 219 | |
220 | 220 | $this->pdf->setContent($html) |
221 | - ->setFilename($save ? $filepath : $filename) |
|
222 | - ->setFormat($format) |
|
223 | - ->generate(); |
|
221 | + ->setFilename($save ? $filepath : $filename) |
|
222 | + ->setFormat($format) |
|
223 | + ->generate(); |
|
224 | 224 | |
225 | 225 | if ($save) { |
226 | 226 | $this->pdf->save(); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return string|null the full file path |
77 | 77 | */ |
78 | 78 | public function generateReport( |
79 | - string|int $reportId, |
|
79 | + string | int $reportId, |
|
80 | 80 | array $data = [], |
81 | 81 | string $filename = '', |
82 | 82 | string $format = 'portrait' |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return void |
100 | 100 | */ |
101 | 101 | public function printReport( |
102 | - string|int $reportId, |
|
102 | + string | int $reportId, |
|
103 | 103 | array $data = [], |
104 | 104 | string $filename = '', |
105 | 105 | string $format = 'portrait' |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param string|int $reportId |
134 | 134 | * @return string |
135 | 135 | */ |
136 | - public function getReportContent(string|int $reportId): string |
|
136 | + public function getReportContent(string | int $reportId): string |
|
137 | 137 | { |
138 | 138 | $useCache = $this->config->get('platform.cache_print_report_content', false); |
139 | 139 | if ($useCache) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @param string|int $reportId |
154 | 154 | * @return string |
155 | 155 | */ |
156 | - public function getRealReportContent(string|int $reportId): string |
|
156 | + public function getRealReportContent(string | int $reportId): string |
|
157 | 157 | { |
158 | 158 | return ''; |
159 | 159 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @param array<string, mixed> $reportData |
165 | 165 | * @return void |
166 | 166 | */ |
167 | - public function debugReport(string|int $reportId, array $reportData): void |
|
167 | + public function debugReport(string | int $reportId, array $reportData): void |
|
168 | 168 | { |
169 | 169 | $reportDebugPath = $this->config->get('platform.report_debug_path'); |
170 | 170 | if ($reportDebugPath !== null) { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @return string|null the full file path |
188 | 188 | */ |
189 | 189 | protected function handleReport( |
190 | - string|int $reportId, |
|
190 | + string | int $reportId, |
|
191 | 191 | array $data = [], |
192 | 192 | string $filename = '', |
193 | 193 | bool $save = false, |
@@ -46,8 +46,7 @@ |
||
46 | 46 | * @package Platine\Framework\Helper |
47 | 47 | * @template T |
48 | 48 | */ |
49 | -class PrintHelper |
|
50 | -{ |
|
49 | +class PrintHelper { |
|
51 | 50 | /** |
52 | 51 | * Create new instance |
53 | 52 | * @param PDF $pdf |
@@ -133,9 +133,9 @@ |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
136 | - * |
|
137 | - * @return Pagination |
|
138 | - */ |
|
136 | + * |
|
137 | + * @return Pagination |
|
138 | + */ |
|
139 | 139 | public function getPagination(): Pagination |
140 | 140 | { |
141 | 141 | return $this->pagination; |
@@ -46,8 +46,7 @@ |
||
46 | 46 | * @package Platine\Framework\Helper |
47 | 47 | * @template T |
48 | 48 | */ |
49 | -class ActionHelper |
|
50 | -{ |
|
49 | +class ActionHelper { |
|
51 | 50 | /** |
52 | 51 | * Create new instance |
53 | 52 | * @param Pagination $pagination |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | array $tables = [] |
63 | 63 | ): void { |
64 | 64 | $this->dbDump->setCompress($compress) |
65 | - ->setTables($tables) |
|
66 | - ->backup($filename); |
|
65 | + ->setTables($tables) |
|
66 | + ->backup($filename); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -75,6 +75,6 @@ discard block |
||
75 | 75 | public function restore(string $filename, bool $compress = false): void |
76 | 76 | { |
77 | 77 | $this->dbDump->setCompress($compress) |
78 | - ->restore($filename); |
|
78 | + ->restore($filename); |
|
79 | 79 | } |
80 | 80 | } |
@@ -39,14 +39,12 @@ |
||
39 | 39 | * @class DatabaseHelper |
40 | 40 | * @package Platine\Framework\Helper |
41 | 41 | */ |
42 | -class DatabaseHelper |
|
43 | -{ |
|
42 | +class DatabaseHelper { |
|
44 | 43 | /** |
45 | 44 | * Create new instance |
46 | 45 | * @param DatabaseDump $dbDump |
47 | 46 | */ |
48 | - public function __construct(protected DatabaseDump $dbDump) |
|
49 | - { |
|
47 | + public function __construct(protected DatabaseDump $dbDump) { |
|
50 | 48 | } |
51 | 49 | |
52 | 50 | /** |