src/Application/AppFactory.php
private static function buildContainer($containerConfig = null): ContainerInterface
    {
        $containerBuilder = new ContainerBuilder();
        $env = $_ENV['ENV'] ?? App::ENV_PROD;

        if (App::ENV_PROD === $env) {
            /*$containerBuilder->enableCompilation('tmp/cache');

            if (extension_loaded('acpu')) {
                $containerBuilder->enableDefinitionCache();
            }*/
        }

        if (is_string($containerConfig)) {
            if (is_dir($containerConfig)) {
                $iterator = new FilesystemIterator($containerConfig, FilesystemIterator::SKIP_DOTS);

                foreach ($iterator as $file) {
                    $containerBuilder->addDefinitions($file->getPathname());
                }
            } elseif (file_exists($containerConfig)) {
                $containerBuilder->addDefinitions($containerConfig);
            } else {
                throw new InvalidArgumentException('Config file "' . $containerConfig . '" doesn\'t exists.');
            }

            $container = $containerBuilder->build();
        } elseif (is_array($containerConfig)) {
            $containerBuilder->addDefinitions($containerConfig);
            $container = $containerBuilder->build();
        } else {
            $container = $containerBuilder->build();
        }

        return $container;
    }
private static function buildContainer($containerConfig = null): ContainerInterface
    {
        $containerBuilder = new ContainerBuilder();
        $env = $_ENV['ENV'] ?? App::ENV_PROD;

        if (App::ENV_PROD === $env) {
            /*$containerBuilder->enableCompilation('tmp/cache');

            if (extension_loaded('acpu')) {
                $containerBuilder->enableDefinitionCache();
            }*/
        }

        if (is_string($containerConfig)) {
            if (is_dir($containerConfig)) {
                $iterator = new FilesystemIterator($containerConfig, FilesystemIterator::SKIP_DOTS);

                foreach ($iterator as $file) {
                    $containerBuilder->addDefinitions($file->getPathname());
                }
            } elseif (file_exists($containerConfig)) {
                $containerBuilder->addDefinitions($containerConfig);
            } else {
                throw new InvalidArgumentException('Config file "' . $containerConfig . '" doesn\'t exists.');
            }

            $container = $containerBuilder->build();
        } elseif (is_array($containerConfig)) {
            $containerBuilder->addDefinitions($containerConfig);
            $container = $containerBuilder->build();
        } else {
            $container = $containerBuilder->build();
        }

        return $container;
    }
@param null $containerConfig

@throws \Exception

@return ContainerInterface