@@ -252,19 +252,19 @@ protected function updateConfigFile(): array
252252 // Backup existing config if it exists
253253 if (File::exists ($ configPath )) {
254254 $ existingConfig = File::get ($ configPath );
255- $ backupPath = $ configPath . '.backup- ' . date ('Y-m-d-H-i-s ' );
255+ $ backupPath = $ configPath. '.backup- ' . date ('Y-m-d-H-i-s ' );
256256 File::copy ($ configPath , $ backupPath );
257257 $ backupCreated = true ;
258258 }
259259
260260 // Download latest config file
261261 $ response = Http::timeout (30 )->get (self ::LATEST_CONFIG_URL );
262262
263- if (!$ response ->successful ()) {
263+ if (! $ response ->successful ()) {
264264 return [
265265 'success ' => false ,
266266 'step ' => 'Config Update ' ,
267- 'message ' => 'Failed to download latest config file: HTTP ' . $ response ->status (),
267+ 'message ' => 'Failed to download latest config file: HTTP ' . $ response ->status (),
268268 ];
269269 }
270270
@@ -275,7 +275,7 @@ protected function updateConfigFile(): array
275275 $ mergedConfig = $ this ->mergeConfigFiles ($ existingConfig , $ latestConfig );
276276 File::put ($ configPath , $ mergedConfig );
277277
278- $ message = $ backupCreated
278+ $ message = $ backupCreated
279279 ? 'Updated config file with latest version (backup created) '
280280 : 'Updated config file with latest version ' ;
281281 } else {
@@ -295,7 +295,7 @@ protected function updateConfigFile(): array
295295 return [
296296 'success ' => false ,
297297 'step ' => 'Config Update ' ,
298- 'message ' => 'Failed to update config file: ' . $ e ->getMessage (),
298+ 'message ' => 'Failed to update config file: ' . $ e ->getMessage (),
299299 ];
300300 }
301301 }
@@ -311,10 +311,10 @@ protected function mergeConfigFiles(string $existing, string $latest): string
311311 try {
312312 // Extract custom values from existing config
313313 $ customValues = $ this ->extractCustomValues ($ existing );
314-
314+
315315 // Start with the latest config
316316 $ mergedConfig = $ latest ;
317-
317+
318318 // Apply custom values to the latest config
319319 foreach ($ customValues as $ key => $ value ) {
320320 $ mergedConfig = $ this ->replaceConfigValue ($ mergedConfig , $ key , $ value );
@@ -374,6 +374,7 @@ protected function replaceConfigValue(string $config, string $key, string $value
374374 case 'auth ' :
375375 case 'cache ' :
376376 $ pattern = "/' $ key'\s*=>\s*\[[^\]]*\]/s " ;
377+
377378 return preg_replace ($ pattern , $ value , $ config );
378379 default :
379380 return $ config ;
@@ -617,7 +618,7 @@ protected function generateSuccessResponse(array $results, array $arguments): To
617618 $ response .= "- `app/Restify/Repository.php` - Base repository class \n" ;
618619 $ response .= "- `app/Restify/UserRepository.php` - User repository example \n" ;
619620 $ response .= "- Database migration for action logs \n" ;
620-
621+
621622 if ($ arguments ['update_config ' ] ?? true ) {
622623 $ response .= "- `config/restify.php.backup-*` - Backup of previous config (if existed) \n" ;
623624 }
0 commit comments