@@ -261,19 +261,19 @@ protected function updateConfigFile(): array
261261 // Backup existing config if it exists
262262 if (File::exists ($ configPath )) {
263263 $ existingConfig = File::get ($ configPath );
264- $ backupPath = $ configPath . '.backup- ' . date ('Y-m-d-H-i-s ' );
264+ $ backupPath = $ configPath. '.backup- ' . date ('Y-m-d-H-i-s ' );
265265 File::copy ($ configPath , $ backupPath );
266266 $ backupCreated = true ;
267267 }
268268
269269 // Download latest config file
270270 $ response = Http::timeout (30 )->get (self ::LATEST_CONFIG_URL );
271271
272- if (!$ response ->successful ()) {
272+ if (! $ response ->successful ()) {
273273 return [
274274 'success ' => false ,
275275 'step ' => 'Config Update ' ,
276- 'message ' => 'Failed to download latest config file: HTTP ' . $ response ->status (),
276+ 'message ' => 'Failed to download latest config file: HTTP ' . $ response ->status (),
277277 ];
278278 }
279279
@@ -284,7 +284,7 @@ protected function updateConfigFile(): array
284284 $ mergedConfig = $ this ->mergeConfigFiles ($ existingConfig , $ latestConfig );
285285 File::put ($ configPath , $ mergedConfig );
286286
287- $ message = $ backupCreated
287+ $ message = $ backupCreated
288288 ? 'Updated config file with latest version (backup created) '
289289 : 'Updated config file with latest version ' ;
290290 } else {
@@ -304,7 +304,7 @@ protected function updateConfigFile(): array
304304 return [
305305 'success ' => false ,
306306 'step ' => 'Config Update ' ,
307- 'message ' => 'Failed to update config file: ' . $ e ->getMessage (),
307+ 'message ' => 'Failed to update config file: ' . $ e ->getMessage (),
308308 ];
309309 }
310310 }
@@ -320,10 +320,10 @@ protected function mergeConfigFiles(string $existing, string $latest): string
320320 try {
321321 // Extract custom values from existing config
322322 $ customValues = $ this ->extractCustomValues ($ existing );
323-
323+
324324 // Start with the latest config
325325 $ mergedConfig = $ latest ;
326-
326+
327327 // Apply custom values to the latest config
328328 foreach ($ customValues as $ key => $ value ) {
329329 $ mergedConfig = $ this ->replaceConfigValue ($ mergedConfig , $ key , $ value );
@@ -383,6 +383,7 @@ protected function replaceConfigValue(string $config, string $key, string $value
383383 case 'auth ' :
384384 case 'cache ' :
385385 $ pattern = "/' $ key'\s*=>\s*\[[^\]]*\]/s " ;
386+
386387 return preg_replace ($ pattern , $ value , $ config );
387388 default :
388389 return $ config ;
@@ -714,7 +715,7 @@ protected function generateSuccessResponse(array $results, array $arguments): To
714715 $ response .= "- `app/Restify/Repository.php` - Base repository class \n" ;
715716 $ response .= "- `app/Restify/UserRepository.php` - User repository example \n" ;
716717 $ response .= "- Database migration for action logs \n" ;
717-
718+
718719 if ($ arguments ['update_config ' ] ?? true ) {
719720 $ response .= "- `config/restify.php.backup-*` - Backup of previous config (if existed) \n" ;
720721 }
0 commit comments