Esempio n. 1
0
 /**
  * Set default parameters to a class.
  *
  * @param   array  $parameters    Parameters to set.
  * @return  void
  * @throws  \Hoa\Core\Exception
  */
 private function setDefault(array $parameters)
 {
     if ($this->_owner == 'Hoa\\Core\\Core') {
         $class = 'HoaCoreCore';
         $this->_parameters = $parameters;
         $path = $this->zFormat($parameters['protocol.Data/Etc/Configuration']) . '.Cache' . DS . 'HoaCoreCore.php';
     } else {
         $class = str_replace('\\', '', Core\Consistency::getEntityShortestName($this->_owner));
         $path = 'hoa://Data/Etc/Configuration/.Cache/' . $class . '.php';
     }
     if (file_exists($path)) {
         $handle = (require $path);
         if (!is_array($handle)) {
             throw new Core\Exception('Strange though it may appear, the configuration cache ' . 'file %s appears to be corrupted.', 0, $path);
         }
         if (!array_key_exists('keywords', $handle)) {
             throw new Core\Exception('Need keywords in the configuration cache %s.', 1, $path);
         }
         if (!array_key_exists('parameters', $handle)) {
             throw new Core\Exception('Need parameters in the configuration cache %s.', 2, $path);
         }
         $this->_keywords = $handle['keywords'];
         $this->_parameters = $handle['parameters'];
     } else {
         $this->_parameters = $parameters;
     }
     return;
 }