@@ -192,7 +192,7 @@ |
||
192 | 192 | $nextIndex = 0; |
193 | 193 | $hashMap = []; // hash => index |
194 | 194 | $settingsData = []; // index => instance data |
195 | - $getIndex = function (SettingsInterface $instance) use (&$nextIndex, &$hashMap, &$settingsData): int { |
|
195 | + $getIndex = function(SettingsInterface $instance) use (&$nextIndex, &$hashMap, &$settingsData): int { |
|
196 | 196 | $hash = spl_object_hash($instance); |
197 | 197 | if (array_key_exists($hash, $hashMap) === true) { |
198 | 198 | $index = $hashMap[$hash]; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public static function configureContainer(LimoncelloContainerInterface $container): void |
39 | 39 | { |
40 | 40 | $container[CommandStorageInterface::class] = |
41 | - function (PsrContainerInterface $container): CommandStorageInterface { |
|
41 | + function(PsrContainerInterface $container): CommandStorageInterface { |
|
42 | 42 | $creator = new class |
43 | 43 | { |
44 | 44 | use ClassIsTrait; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $providerClasses = $appConfig[S::KEY_PROVIDER_CLASSES]; |
80 | 80 | $commandsFolder = $appConfig[S::KEY_COMMANDS_FOLDER]; |
81 | 81 | $commandsFileMask = $appConfig[S::KEY_COMMANDS_FILE_MASK] ?? '*.php'; |
82 | - $commandsPath = $commandsFolder . DIRECTORY_SEPARATOR . $commandsFileMask; |
|
82 | + $commandsPath = $commandsFolder.DIRECTORY_SEPARATOR.$commandsFileMask; |
|
83 | 83 | |
84 | 84 | $storage = $creator->createCommandStorage($commandsPath, $providerClasses); |
85 | 85 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $this->executeClear($container, $inOut); |
113 | 113 | break; |
114 | 114 | default: |
115 | - $inOut->writeError("Unsupported action `$action`." . PHP_EOL); |
|
115 | + $inOut->writeError("Unsupported action `$action`.".PHP_EOL); |
|
116 | 116 | break; |
117 | 117 | } |
118 | 118 | } |
@@ -137,17 +137,17 @@ discard block |
||
137 | 137 | throw new ConfigurationException(); |
138 | 138 | } |
139 | 139 | |
140 | - $path = $cacheDir . DIRECTORY_SEPARATOR . $class . '.php'; |
|
140 | + $path = $cacheDir.DIRECTORY_SEPARATOR.$class.'.php'; |
|
141 | 141 | |
142 | 142 | $fileSystem = $this->getFileSystem($container); |
143 | 143 | if ($fileSystem->exists($path) === true) { |
144 | 144 | $fileSystem->delete($path); |
145 | - $inOut->writeInfo("Cache file deleted `$path`." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE); |
|
145 | + $inOut->writeInfo("Cache file deleted `$path`.".PHP_EOL, IoInterface::VERBOSITY_VERBOSE); |
|
146 | 146 | |
147 | 147 | return; |
148 | 148 | } |
149 | 149 | |
150 | - $inOut->writeInfo('Cache already clean.' . PHP_EOL); |
|
150 | + $inOut->writeInfo('Cache already clean.'.PHP_EOL); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | $settingsData = $settingsProvider->serialize(); |
175 | 175 | $content = $this->composeContent($settingsData, $namespace, $class, $method); |
176 | 176 | |
177 | - $path = $cacheDir . DIRECTORY_SEPARATOR . $class . '.php'; |
|
177 | + $path = $cacheDir.DIRECTORY_SEPARATOR.$class.'.php'; |
|
178 | 178 | $this->getFileSystem($container)->write($path, $content); |
179 | 179 | |
180 | - $inOut->writeInfo('Cache created.' . PHP_EOL); |
|
181 | - $inOut->writeInfo("Cache written to `$path`." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE); |
|
180 | + $inOut->writeInfo('Cache created.'.PHP_EOL); |
|
181 | + $inOut->writeInfo("Cache written to `$path`.".PHP_EOL, IoInterface::VERBOSITY_VERBOSE); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | |
246 | 246 | assert( |
247 | 247 | $data !== null, |
248 | - 'It seems the data are not exportable. It is likely to be caused by class instances ' . |
|
249 | - 'that do not implement ` __set_state` magic method required by `var_export`. ' . |
|
248 | + 'It seems the data are not exportable. It is likely to be caused by class instances '. |
|
249 | + 'that do not implement ` __set_state` magic method required by `var_export`. '. |
|
250 | 250 | 'See http://php.net/manual/en/language.oop5.magic.php#object.set-state for more details.' |
251 | 251 | ); |
252 | 252 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public static function configureContainer(LimoncelloContainerInterface $container): void |
45 | 45 | { |
46 | - $container[LoggerInterface::class] = function (PsrContainerInterface $container) { |
|
46 | + $container[LoggerInterface::class] = function(PsrContainerInterface $container) { |
|
47 | 47 | /** @var CacheSettingsProviderInterface $settingsProvider */ |
48 | 48 | $settingsProvider = $container->get(CacheSettingsProviderInterface::class); |
49 | 49 | $appConfig = $settingsProvider->getApplicationConfiguration(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | - * @return array |
|
72 | + * @return string |
|
73 | 73 | */ |
74 | 74 | protected function getSettings(): array |
75 | 75 | { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | /** |
90 | 90 | * |
91 | - * @return iterable |
|
91 | + * @return \Generator |
|
92 | 92 | */ |
93 | 93 | private function getMessageDescriptionsFromProviders(): iterable |
94 | 94 | { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ); |
66 | 66 | assert(empty($logFile) === false, "Invalid Logs file name `$logFile`."); |
67 | 67 | |
68 | - $logPath = $logFolder . DIRECTORY_SEPARATOR . $logFile; |
|
68 | + $logPath = $logFolder.DIRECTORY_SEPARATOR.$logFile; |
|
69 | 69 | |
70 | 70 | return $defaults + [static::KEY_LOG_PATH => $logPath]; |
71 | 71 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | { |
78 | 78 | $appConfig = $this->getAppConfig(); |
79 | 79 | |
80 | - $isDebug = (bool)($appConfig[A::KEY_IS_DEBUG] ?? false); |
|
80 | + $isDebug = (bool) ($appConfig[A::KEY_IS_DEBUG] ?? false); |
|
81 | 81 | |
82 | 82 | return [ |
83 | - static::KEY_IS_ENABLED => (bool)($appConfig[A::KEY_IS_LOG_ENABLED] ?? false), |
|
83 | + static::KEY_IS_ENABLED => (bool) ($appConfig[A::KEY_IS_LOG_ENABLED] ?? false), |
|
84 | 84 | static::KEY_LOG_LEVEL => $isDebug === true ? Logger::DEBUG : Logger::INFO, |
85 | 85 | static::KEY_LOG_FILE => 'limoncello.log', |
86 | 86 | ]; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | ]); |
188 | 188 | break; |
189 | 189 | default: |
190 | - $inOut->writeError("Unsupported item type `$item`." . PHP_EOL); |
|
190 | + $inOut->writeError("Unsupported item type `$item`.".PHP_EOL); |
|
191 | 191 | break; |
192 | 192 | } |
193 | 193 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | private function composeMigrationParameters(ContainerInterface $container, string $singular, string $plural): array |
205 | 205 | { |
206 | 206 | $outputPath = $this->getDataSettings($container)[DataSettingsInterface::KEY_MIGRATIONS_FOLDER] |
207 | - . DIRECTORY_SEPARATOR . $plural . 'Migration.php'; |
|
207 | + . DIRECTORY_SEPARATOR.$plural.'Migration.php'; |
|
208 | 208 | $parameters = [ |
209 | 209 | '{%SINGULAR_CC%}' => $singular, |
210 | 210 | '{%PLURAL_CC%}' => $plural, |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | private function composeSeedParameters(ContainerInterface $container, string $singular, string $plural): array |
226 | 226 | { |
227 | 227 | $outputPath = $this->getDataSettings($container)[DataSettingsInterface::KEY_SEEDS_FOLDER] |
228 | - . DIRECTORY_SEPARATOR . $plural . 'Seed.php'; |
|
228 | + . DIRECTORY_SEPARATOR.$plural.'Seed.php'; |
|
229 | 229 | $parameters = [ |
230 | 230 | '{%SINGULAR_CC%}' => $singular, |
231 | 231 | '{%PLURAL_CC%}' => $plural, |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | private function composeModelParameters(ContainerInterface $container, string $singular, string $plural): array |
247 | 247 | { |
248 | 248 | $outputPath = $this->getDataSettings($container)[DataSettingsInterface::KEY_MODELS_FOLDER] |
249 | - . DIRECTORY_SEPARATOR . $singular . '.php'; |
|
249 | + . DIRECTORY_SEPARATOR.$singular.'.php'; |
|
250 | 250 | $parameters = [ |
251 | 251 | '{%SINGULAR_CC%}' => $singular, |
252 | 252 | '{%SINGULAR_LC%}' => strtolower($singular), |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | private function composeSchemaParameters(ContainerInterface $container, string $singular, string $plural): array |
271 | 271 | { |
272 | 272 | $outputPath = $this->getFluteSettings($container)[FluteSettingsInterface::KEY_SCHEMAS_FOLDER] |
273 | - . DIRECTORY_SEPARATOR . $singular . 'Schema.php'; |
|
273 | + . DIRECTORY_SEPARATOR.$singular.'Schema.php'; |
|
274 | 274 | $parameters = [ |
275 | 275 | '{%SINGULAR_CC%}' => $singular, |
276 | 276 | '{%PLURAL_LC%}' => strtolower($plural), |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | private function composeApiParameters(ContainerInterface $container, string $singular, string $plural): array |
292 | 292 | { |
293 | 293 | $outputPath = $this->getFluteSettings($container)[FluteSettingsInterface::KEY_API_FOLDER] |
294 | - . DIRECTORY_SEPARATOR . $plural . 'Api.php'; |
|
294 | + . DIRECTORY_SEPARATOR.$plural.'Api.php'; |
|
295 | 295 | $parameters = [ |
296 | 296 | '{%SINGULAR_CC%}' => $singular, |
297 | 297 | '{%PLURAL_CC%}' => $plural, |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | string $plural |
318 | 318 | ): array { |
319 | 319 | $outputPath = $this->getAuthorizationSettings($container)[AuthorizationSettingsInterface::KEY_POLICIES_FOLDER] |
320 | - . DIRECTORY_SEPARATOR . $singular . 'Rules.php'; |
|
320 | + . DIRECTORY_SEPARATOR.$singular.'Rules.php'; |
|
321 | 321 | $parameters = [ |
322 | 322 | '{%SINGULAR_CC%}' => $singular, |
323 | 323 | '{%PLURAL_CC%}' => $plural, |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | string $plural |
345 | 345 | ): array { |
346 | 346 | $outputPath = $this->getFluteSettings($container)[FluteSettingsInterface::KEY_JSON_VALIDATION_RULES_FOLDER] |
347 | - . DIRECTORY_SEPARATOR . $singular . 'Rules.php'; |
|
347 | + . DIRECTORY_SEPARATOR.$singular.'Rules.php'; |
|
348 | 348 | $parameters = [ |
349 | 349 | '{%SINGULAR_CC%}' => $singular, |
350 | 350 | '{%SINGULAR_LC%}' => strtolower($singular), |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | $folder = $this->filterOutFolderMask( |
372 | 372 | $this->getFluteSettings($container)[FluteSettingsInterface::KEY_JSON_VALIDATORS_FOLDER] |
373 | 373 | ); |
374 | - $outputPath = $folder . DIRECTORY_SEPARATOR . $singular . 'Create.php'; |
|
374 | + $outputPath = $folder.DIRECTORY_SEPARATOR.$singular.'Create.php'; |
|
375 | 375 | $parameters = [ |
376 | 376 | '{%SINGULAR_CC%}' => $singular, |
377 | 377 | '{%SINGULAR_LC%}' => strtolower($singular), |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $folder = $this->filterOutFolderMask( |
398 | 398 | $this->getFluteSettings($container)[FluteSettingsInterface::KEY_JSON_VALIDATORS_FOLDER] |
399 | 399 | ); |
400 | - $outputPath = $folder . DIRECTORY_SEPARATOR . $singular . 'Update.php'; |
|
400 | + $outputPath = $folder.DIRECTORY_SEPARATOR.$singular.'Update.php'; |
|
401 | 401 | $parameters = [ |
402 | 402 | '{%SINGULAR_CC%}' => $singular, |
403 | 403 | '{%SINGULAR_LC%}' => strtolower($singular), |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $folder = $this->filterOutFolderMask( |
424 | 424 | $this->getFluteSettings($container)[FluteSettingsInterface::KEY_JSON_CONTROLLERS_FOLDER] |
425 | 425 | ); |
426 | - $outputPath = $folder . DIRECTORY_SEPARATOR . $plural . 'Controller.php'; |
|
426 | + $outputPath = $folder.DIRECTORY_SEPARATOR.$plural.'Controller.php'; |
|
427 | 427 | $parameters = [ |
428 | 428 | '{%SINGULAR_CC%}' => $singular, |
429 | 429 | '{%PLURAL_CC%}' => $plural, |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | $folder = $this->filterOutFolderMask( |
450 | 450 | $this->getFluteSettings($container)[FluteSettingsInterface::KEY_ROUTES_FOLDER] |
451 | 451 | ); |
452 | - $outputPath = $folder . DIRECTORY_SEPARATOR . $singular . 'ApiRoutes.php'; |
|
452 | + $outputPath = $folder.DIRECTORY_SEPARATOR.$singular.'ApiRoutes.php'; |
|
453 | 453 | $parameters = [ |
454 | 454 | '{%SINGULAR_CC%}' => $singular, |
455 | 455 | '{%PLURAL_CC%}' => $plural, |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | $folder = $this->filterOutFolderMask( |
476 | 476 | $this->getFluteSettings($container)[FluteSettingsInterface::KEY_WEB_CONTROLLERS_FOLDER] |
477 | 477 | ); |
478 | - $outputPath = $folder . DIRECTORY_SEPARATOR . $plural . 'Controller.php'; |
|
478 | + $outputPath = $folder.DIRECTORY_SEPARATOR.$plural.'Controller.php'; |
|
479 | 479 | $parameters = [ |
480 | 480 | '{%SINGULAR_CC%}' => $singular, |
481 | 481 | '{%PLURAL_CC%}' => $plural, |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | $folder = $this->filterOutFolderMask( |
503 | 503 | $this->getFluteSettings($container)[FluteSettingsInterface::KEY_ROUTES_FOLDER] |
504 | 504 | ); |
505 | - $outputPath = $folder . DIRECTORY_SEPARATOR . $singular . 'WebRoutes.php'; |
|
505 | + $outputPath = $folder.DIRECTORY_SEPARATOR.$singular.'WebRoutes.php'; |
|
506 | 506 | $parameters = [ |
507 | 507 | '{%SINGULAR_CC%}' => $singular, |
508 | 508 | '{%PLURAL_CC%}' => $plural, |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | { |
677 | 677 | $mask = '**'; |
678 | 678 | |
679 | - $folder = str_replace($mask . DIRECTORY_SEPARATOR, '', $folder); |
|
679 | + $folder = str_replace($mask.DIRECTORY_SEPARATOR, '', $folder); |
|
680 | 680 | $folder = str_replace($mask, '', $folder); |
681 | 681 | |
682 | 682 | return $folder; |
@@ -104,7 +104,7 @@ |
||
104 | 104 | public function setData(array $data): self |
105 | 105 | { |
106 | 106 | list($this->foreignKeys, $this->belongsToMany, $this->relationshipTypes, |
107 | - $this->reversedRelationships,$this->tableNames, $this->primaryKeys, |
|
107 | + $this->reversedRelationships, $this->tableNames, $this->primaryKeys, |
|
108 | 108 | $this->attributeTypes, $this->attributeLengths, $this->attributes, $this->reversedClasses) = $data; |
109 | 109 | |
110 | 110 | return $this; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ); |
89 | 89 | assert(file_exists($seedsListFile) === true, "Invalid Seeds file `$seedsListFile`."); |
90 | 90 | |
91 | - $modelsPath = $modelsFolder . DIRECTORY_SEPARATOR . $modelsFileMask; |
|
91 | + $modelsPath = $modelsFolder.DIRECTORY_SEPARATOR.$modelsFileMask; |
|
92 | 92 | |
93 | 93 | $seedInit = $defaults[static::KEY_SEED_INIT] ?? null; |
94 | 94 | assert( |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $registered = []; |
131 | 131 | $modelSchemas = new ModelSchemaInfo(); |
132 | - $registerModel = function ($modelClass) use ($modelSchemas, &$registered, $requireReverseRel) { |
|
132 | + $registerModel = function($modelClass) use ($modelSchemas, &$registered, $requireReverseRel) { |
|
133 | 133 | /** @var ModelInterface $modelClass */ |
134 | 134 | $modelSchemas->registerClass( |
135 | 135 | $modelClass, |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | foreach ($relationships[RelationshipTypes::BELONGS_TO] as $relName => list($rClass, $fKey, $rRel)) { |
146 | 146 | /** @var string $rClass */ |
147 | 147 | $modelSchemas->registerBelongsToOneRelationship($modelClass, $relName, $fKey, $rClass, $rRel); |
148 | - $registered[(string)$modelClass][$relName] = true; |
|
148 | + $registered[(string) $modelClass][$relName] = true; |
|
149 | 149 | $registered[$rClass][$rRel] = true; |
150 | 150 | |
151 | 151 | // Sanity check. Every `belongs_to` should be paired with `has_many` on the other side. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $rRelationships[RelationshipTypes::HAS_MANY][$rRel] === [$modelClass, $fKey, $relName]); |
157 | 157 | /** @var string $modelClass */ |
158 | 158 | |
159 | - assert($isRelationshipOk, "`belongsTo` relationship `$relName` of class $modelClass " . |
|
159 | + assert($isRelationshipOk, "`belongsTo` relationship `$relName` of class $modelClass ". |
|
160 | 160 | "should be paired with `hasMany` relationship."); |
161 | 161 | } |
162 | 162 | } |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | (isset($rRelationships[RelationshipTypes::BELONGS_TO][$rRel]) === true && |
171 | 171 | $rRelationships[RelationshipTypes::BELONGS_TO][$rRel] === [$modelClass, $fKey, $relName]); |
172 | 172 | /** @var string $modelClass */ |
173 | - assert($isRelationshipOk, "`hasMany` relationship `$relName` of class $modelClass " . |
|
173 | + assert($isRelationshipOk, "`hasMany` relationship `$relName` of class $modelClass ". |
|
174 | 174 | "should be paired with `belongsTo` relationship."); |
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | 178 | if (array_key_exists(RelationshipTypes::BELONGS_TO_MANY, $relationships) === true) { |
179 | 179 | foreach ($relationships[RelationshipTypes::BELONGS_TO_MANY] as $relName => $data) { |
180 | - if (isset($registered[(string)$modelClass][$relName]) === true) { |
|
180 | + if (isset($registered[(string) $modelClass][$relName]) === true) { |
|
181 | 181 | continue; |
182 | 182 | } |
183 | 183 | /** @var string $rClass */ |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $rClass, |
192 | 192 | $rRel |
193 | 193 | ); |
194 | - $registered[(string)$modelClass][$relName] = true; |
|
194 | + $registered[(string) $modelClass][$relName] = true; |
|
195 | 195 | $registered[$rClass][$rRel] = true; |
196 | 196 | } |
197 | 197 | } |