示例#1
0
 /**
  * Extend setConfig to set the routes 
  * 
  * @see Aspamia_Http_Server_Handler_Abstract::setConfig()
  */
 public function setConfig($config)
 {
     parent::setConfig($config);
     if (is_array($this->_config['routes'])) {
         foreach ($this->_config['routes'] as $route) {
             if (isset($route['route']) && isset($route['handler'])) {
                 $config = isset($route['options']) ? $route['options'] : array();
                 $this->addRouteHandler($route['route'], $route['handler'], $config);
             }
         }
     }
 }
示例#2
0
 /**
  * Overload setConfig to make sure some config options are OK
  *
  * @param Zend_Config | array $config
  */
 public function setConfig($config)
 {
     parent::setConfig($config);
     if (!is_array($this->_config['directory_index'])) {
         if (strlen($this->_config['directory_index'])) {
             $this->_config['directory_index'] = array($this->_config['directory_index']);
         } else {
             $this->_config['directory_index'] = array();
         }
     }
     if (!is_array($this->_config['mime_types'])) {
         require_once 'Aspamia/Http/Server/Handler/Exception.php';
         throw new Aspamia_Http_Server_Handler_Exception("MIME type configuration must be an array");
     }
 }