Esempio n. 1
0
 /**
  * Gets a value from the registry
  *
  * @param  string $name
  * @return mixed
  */
 public function getFromRegistry($name)
 {
     return Registry::get($name);
 }
Esempio n. 2
0
 /**
  * Init the environment types from
  * the config files
  */
 protected final function initEnvironmentTypes()
 {
     $environment = Registry::get('environment');
     foreach ($this->config->getElementsByPath('environment/type') as $type) {
         $flags = $type->getAttribute('flags');
         $name = $type->getAttribute('name');
         /**
          * If the name is not given "ignore"
          * this element
          */
         if (!$name) {
             continue;
         }
         /**
          * Create name with appended
          * flags to parse them later
          */
         $nameWf = $name;
         if ($flags) {
             $nameWf .= Environment::TYPE_FLAG_SEPERTOR;
             $nameWf .= ltrim($flags, Environment::TYPE_FLAG_SEPERTOR);
         }
         $environment->addType($nameWf);
         /**
          * Add conditions from type
          * if they are given
          */
         foreach ($type->getChildrenByName('condition') as $condition) {
             $type = $condition->getAttribute('type');
             $value = $condition->getAttribute('value');
             /**
              * Add a specific type to the environment
              * defined with some aliases for each
              * type
              */
             if ($type && $value) {
                 switch ($type) {
                     case 'url':
                     case 'urlpattern':
                     case 'url-pattern':
                         $environment->addUrlPattern($name, $value);
                         break;
                     case 'host':
                     case 'hostname':
                         $environment->addHostname($name, $value);
                         break;
                 }
             }
         }
     }
     $this->config->setEnvironment($environment);
     $this->config->applyEnvironment();
 }