Skip to content

Commit 9c41ddb

Browse files
authored
Merge pull request #1020 from hydephp/refactor-internal-load-configuration-class
Refactor internal LoadConfiguration class
2 parents ad306f7 + d71afb0 commit 9c41ddb

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

packages/framework/src/Foundation/Internal/LoadConfiguration.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,27 @@ protected function loadConfigurationFiles(Application $app, RepositoryContract $
2525
{
2626
parent::loadConfigurationFiles($app, $repository);
2727

28-
$this->mergeConfigurationFiles($repository, ['view', 'cache', 'commands', 'torchlight']);
28+
$this->mergeConfigurationFiles($repository);
2929
}
3030

31-
/** These files do commonly not need to be customized by the user, so to get them out of the way, we don't include them in the default project install. */
32-
protected function mergeConfigurationFiles(RepositoryContract $repository, array $keys): void
31+
private function mergeConfigurationFiles(RepositoryContract $repository): void
3332
{
34-
foreach ($keys as $key) {
35-
$this->mergeConfigurationFile($repository, $key);
33+
// These files do commonly not need to be customized by the user, so to get them out of the way,
34+
// we don't include them in the default project install.
35+
36+
foreach (['view', 'cache', 'commands', 'torchlight'] as $file) {
37+
$this->mergeConfigurationFile($repository, $file);
3638
}
3739
}
3840

39-
/** We of course want the user to be able to customize the config files, if they're present, so we'll merge their changes here. */
40-
protected function mergeConfigurationFile(RepositoryContract $repository, string $key): void
41+
private function mergeConfigurationFile(RepositoryContract $repository, string $file): void
4142
{
42-
$repository->set($key, array_merge(
43-
require __DIR__."/../../../config/$key.php",
44-
$repository->get($key, [])
43+
// We of course want the user to be able to customize the config files,
44+
// if they're present, so we'll merge their changes here.
45+
46+
$repository->set($file, array_merge(
47+
require __DIR__."/../../../config/$file.php",
48+
(array) $repository->get($file, [])
4549
));
4650
}
4751
}

0 commit comments

Comments
 (0)