예제 #1
0
 protected function _applyConfig()
 {
     //#TODO #2.0.0 loop through the tags instead
     $autoLoad = $this->_config->getOptional('autoLoad', FALSE);
     $debugMode = $this->_config->getOptional('debug:mode', Saf_Debug::DEBUG_MODE_OFF);
     $errorMode = $this->_config->getOptional('error:mode', Saf_Debug::ERROR_MODE_DEFAULT);
     Saf_Debug::init($debugMode, $errorMode, FALSE);
     if ($autoLoad) {
         $autoLoadTakeover = array_key_exists('takeover', $autoLoad) && Saf_Filter_Truthy::filter($autoLoad['takeover']);
         Saf_Kickstart::initializeAutoloader($autoLoad);
         if (array_key_exists('loader', $autoLoad)) {
             $loaders = Saf_Config::autoGroup($autoLoad['loader']);
             foreach ($loaders as $loader) {
                 $loaderParts = explode(':', Saf_Filter_ConfigString($loader), 2);
                 !array_key_exists(1, $loaderParts) ? Saf_Kickstart::addAutoloader($loaderParts[0]) : Saf_Kickstart::addAutoloader($loaderParts[0], $loaderParts[1]);
             }
         }
         if (array_key_exists('library', $autoLoad)) {
             $libraries = Saf_Config::autoGroup($autoLoad['library']);
             foreach ($libraries as $library) {
                 $libParts = explode(':', Saf_Filter_ConfigString($library), 2);
                 !array_key_exists(1, $libParts) ? Saf_Kickstart::addLibrary($libParts[0]) : Saf_Kickstart::addLibrary(array($libParts[0], $libParts[1]));
             }
         }
         if (array_key_exists('special', $autoLoad)) {
             $specialLoaders = Saf_Config::autoGroup($autoLoad['special']);
             foreach ($specialLoaders as $special) {
                 $specialParts = explode(':', Saf_Filter_ConfigString($special), 2);
                 !array_key_exists(1, $specialParts) ? Saf_Kickstart::addLibrary(array($specialParts[0])) : Saf_Kickstart::addLibrary(array($specialParts[0], $specialParts[1]));
             }
         }
     }
     $this->_bootstrapConfig = $this->_config->getOptional('bootstrap', NULL);
     if ($this->_config->has('resources')) {
         $resources = Saf_Array::coerce($this->_config->get('resources:+'), Saf_Array::MODE_TRUNCATE);
         foreach ($resources as $pluginName => $pluginConfig) {
             $this->provision($pluginName, $pluginConfig);
         }
     }
 }