Ejemplo n.º 1
0
 /**
  * Create a new container.
  *
  * @return ContainerInterface
  */
 protected function createContainer()
 {
     $container = new ContainerBuilder();
     // Default configuration.
     $container->set('application', $this);
     $container->set('configuration.loader', $this->configurationLoader);
     $container->set('extension_manager', $this->extensionManager);
     // Initialize extensions.
     $this->extensionManager->initialize($container);
     // Load configuration.
     try {
         $rawConfigs = $this->configurationLoader->loadConfiguration();
         $this->extensionManager->load($rawConfigs, $container);
     } catch (ConfigurationLoadingException $e) {
         // No configuration file found.
         // Continue with restricted services if `ignoreMissingConfiguration`
         // has been specified.
         if (!$this->ignoreMissingConfiguration) {
             throw $e;
         }
     }
     // Process compiler pass & compile container
     $container->compile();
     return $container;
 }
Ejemplo n.º 2
0
 /**
  * @param ConfigurationLoader $configurationLoader
  * @param array $filesConfiguration
  */
 public function __construct(ConfigurationLoader $configurationLoader, array $filesConfiguration = array())
 {
     $this->configurationLoader = $configurationLoader;
     $this->fileSets = [];
     foreach ($filesConfiguration as $config) {
         $rootDir = $this->configurationLoader->getRootDirectory();
         $matcher = new Matcher($config['pattern']);
         $options = $config['options'];
         $fileSet = new FileSet($rootDir, $matcher, $options);
         $this->addFileSet($fileSet);
     }
 }