Ejemplo n.º 1
0
 private function _06_registerClassLoaderIfRequested()
 {
     if (!$this->_bootSettings->isClassLoaderEnabled()) {
         return;
     }
     $expectedPath = $this->_bootSettings->getPathToSystemCacheDirectory() . DIRECTORY_SEPARATOR . 'classmap.php';
     $debugEnabled = $this->_bootLogger->isEnabled();
     if ($debugEnabled) {
         $this->_logDebug(sprintf('Attempting to include classmap from <code>%s</code>', $expectedPath));
     }
     if (!is_readable($expectedPath)) {
         if ($debugEnabled) {
             $this->_logDebug(sprintf('<code>%s</code> is not readable. That\'s not great.', $expectedPath));
         }
         return;
     }
     if ($debugEnabled) {
         $this->_logDebug(sprintf('<code>%s</code> is readable.', $expectedPath));
     }
     if (!class_exists('Symfony\\Component\\ClassLoader\\MapClassLoader', false)) {
         require TUBEPRESS_ROOT . '/vendor/symfony/class-loader/MapClassLoader.php';
     }
     $classMap = (require $expectedPath);
     $mapClassLoader = new \Symfony\Component\ClassLoader\MapClassLoader($classMap);
     $mapClassLoader->register();
     if ($debugEnabled) {
         $this->_logDebug(sprintf('Successfully loaded a map of <code>%d</code> classes from <code>%s</code>.', count($classMap), $expectedPath));
     }
 }
 public function getNewSymfonyContainer()
 {
     if (!isset($this->_containerBuilder)) {
         $this->_containerBuilder = new tubepress_internal_ioc_ContainerBuilder();
     }
     $this->_containerBuilder->set('tubepress_api_ioc_ContainerInterface', $this->_containerBuilder);
     $this->_containerBuilder->set('symfony_service_container', $this->_containerBuilder->getDelegateContainerBuilder());
     $this->_containerBuilder->set('tubepress_internal_logger_BootLogger', $this->_logger);
     $this->_containerBuilder->set(tubepress_api_boot_BootSettingsInterface::_, $this->_bootSettings);
     $addons = $this->_findAllAddons();
     if ($this->_bootSettings->isClassLoaderEnabled()) {
         $this->_setupClassLoader($addons);
     }
     $this->_iocCompiler->compile($this->_containerBuilder, $addons);
     if ($this->_bootSettings->isClassLoaderEnabled()) {
         spl_autoload_unregister(array($this->_mapClassLoader, 'loadClass'));
     }
     return $this->_convertToSymfonyContainer($this->_containerBuilder);
 }