|
1234567891011121314151617181920212223242526272829303132 |
- <?php
-
- namespace Symfony\Component\DependencyInjection\Loader\Configurator;
-
- return function(ContainerConfigurator $configurator) {
-
- $services = $configurator->services();
-
- $baseDirectoryDependency = dirname(__FILE__).'/../src/Dependency/';
- $directoriesDenpendencyInjection = scandir($baseDirectoryDependency);
- $dependencies = [];
- foreach($directoriesDenpendencyInjection as $directory) {
- if($directory != '.' && $directory != '..' && is_dir($baseDirectoryDependency.$directory)) {
- $filesDenpendencyInjection = scandir($baseDirectoryDependency.$directory);
- foreach($filesDenpendencyInjection as $file) {
- if($file != '.' && $file != '..') {
- $classDependency = 'App\Dependency\\'.$directory.'\\'.str_replace('.php', '', $file) ;
- $dependencies[] = new $classDependency;
- }
- }
- }
- }
-
- foreach($dependencies as $dependency) {
- $aliases = $dependency->getAliases();
-
- foreach($aliases as $alias => $final) {
- $services->alias($alias, $final);
- }
- }
-
- };
|