Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 4, 2024
1 parent 6cb1d99 commit ce4fb74
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ protected function loadConfigurationFile(RepositoryContract $repository, $name,

if (isset($base[$name])) {
$config = array_merge($base[$name], $config);
if (($option = $this->smartMergeOption($name)) && isset($config[$option])) {
$config[$option] = array_merge($base[$name][$option], $config[$option]);

foreach ($this->mergeableOptions($name) as $option) {
if (isset($config[$option])) {
$config[$option] = array_merge($base[$name][$option], $config[$option]);
}
}

unset($base[$name]);
Expand All @@ -105,23 +108,22 @@ protected function loadConfigurationFile(RepositoryContract $repository, $name,
}

/**
* Return the option within the configuration file
* which allows another level of merging.
* Get the options within the configuration file that should be merged again.
*
* @param string $name
* @return string|null
* @return array
*/
protected function smartMergeOption($name)
protected function mergeableOptions($name)
{
return [
'broadcasting' => 'connections',
'cache' => 'stores',
'database' => 'connections',
'filesystems' => 'disks',
'logging' => 'channels',
'mail' => 'mailers',
'queue' => 'connections',
][$name] ?? null;
'broadcasting' => ['connections'],
'cache' => ['stores'],
'database' => ['connections'],
'filesystems' => ['disks'],
'logging' => ['channels'],
'mail' => ['mailers'],
'queue' => ['connections'],
][$name] ?? [];
}

/**
Expand Down

0 comments on commit ce4fb74

Please sign in to comment.