Config.php

Go to the documentation of this file.
00001 <?php
00002 
00031 class Robo47_Application_Resource_Config
00032 extends Zend_Application_Resource_ResourceAbstract
00033 {
00034 
00038     protected $_config = null;
00039     
00040     public function init()
00041     {
00042         if (!empty($this->_options)) {
00043             $this->_config = $this->_setupConfig($this->_options);
00044         } else {
00045             $message = 'Empty options in resource ' .
00046                 'Robo47_Application_Resource_Config.';
00047             throw new Robo47_Application_Resource_Exception($message);
00048         }
00049     }
00050 
00056     protected function _setupConfig($options)
00057     {
00058         if (!isset($options['config'])) {
00059             $message = 'No data for Zend_Config found';
00060             throw new Robo47_Application_Resource_Exception($message);
00061         }
00062         $config = new Zend_Config($options['config']);
00063 
00064         if (isset($options['registryKey'])) {
00065             Zend_Registry::set($options['registryKey'], $config);
00066         }
00067         return $config;
00068     }
00069 
00075     public function getConfig()
00076     {
00077         return $this->_config;
00078     }
00079 }