Beispiel #1
0
 /**
  * Initialize class - gets called from the parent constructor
  * @throws WURFL_WURFLException configuration not present
  */
 protected function initialize()
 {
     include parent::getConfigFilePath();
     if (!isset($configuration) || !is_array($configuration)) {
         throw new WURFL_WURFLException("Configuration array must be defined in the configuraiton file");
     }
     $this->init($configuration);
 }
Beispiel #2
0
 protected function initialize()
 {
     include parent::getConfigFilePath();
     $configurationArrayDefined = isset($configuration);
     if (!$configurationArrayDefined) {
         throw new Exception("configuration array must be defined in the configuraiton file");
     }
     $this->init($configuration);
 }
Beispiel #3
-1
 /**
  * Reads the configuration file and creates the class attributes
  *
  */
 protected function initialize()
 {
     $reader = new XMLReader();
     $reader->open(parent::getConfigFilePath());
     $reader->setRelaxNGSchemaSource(self::WURFL_CONF_SCHEMA);
     libxml_use_internal_errors(TRUE);
     while ($reader->read()) {
         if (!$reader->isValid()) {
             throw new Exception(libxml_get_last_error()->message);
         }
         $name = $reader->name;
         switch ($reader->nodeType) {
             case XMLReader::ELEMENT:
                 $this->_handleStartElement($name);
                 break;
             case XMLReader::TEXT:
                 $this->_handleTextElement($reader->value);
                 break;
             case XMLReader::END_ELEMENT:
                 $this->_handleEndElement($name);
                 break;
         }
     }
     $reader->close();
     if (isset($this->cache["dir"])) {
         $this->logDir = $this->cache["dir"];
     }
 }