Skip to content

Commit

Permalink
Refactor AbstractFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
Chemaclass committed Oct 14, 2023
1 parent 2e45a15 commit e2d5011
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -32,7 +32,7 @@
"gacela-project/container": "^0.5"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.34",
"friendsofphp/php-cs-fixer": "^3.35",
"infection/infection": "^0.26",
"phpbench/phpbench": "^1.2",
"phpmetrics/phpmetrics": "^2.8",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/Framework/AbstractConfig.php
Expand Up @@ -18,6 +18,8 @@ public function getAppRootDir(): string
}

/**
* Get a project config value by its key.
*
* @throws ConfigException
*/
protected function get(string $key, mixed $default = Config::DEFAULT_CONFIG_VALUE): mixed
Expand Down
10 changes: 1 addition & 9 deletions src/Framework/AbstractFactory.php
Expand Up @@ -43,17 +43,9 @@ private function createContainerWithProvidedDependencies(): Container
{
$container = Container::withConfig(Config::getInstance());

$dependencyProvider = $this->resolveDependencyProvider();
$dependencyProvider = (new DependencyProviderResolver())->resolve($this);
$dependencyProvider->provideModuleDependencies($container);

return $container;
}

/**
* @throws ClassResolver\DependencyProvider\DependencyProviderNotFoundException
*/
private function resolveDependencyProvider(): AbstractDependencyProvider
{
return (new DependencyProviderResolver())->resolve($this);
}
}

0 comments on commit e2d5011

Please sign in to comment.