web/lib/Zend/Tool/Framework/Client/Abstract.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Tool
    16  * @package    Zend_Tool
    17  * @subpackage Framework
    17  * @subpackage Framework
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @version    $Id: Abstract.php 23204 2010-10-21 15:35:21Z ralph $
    20  * @version    $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
    21  */
    21  */
    22 
    22 
    23 /**
    23 /**
    24  * @see Zend_Loader_Autoloader
    24  * @see Zend_Loader_Autoloader
    25  */
    25  */
    31 require_once 'Zend/Tool/Framework/Registry/EnabledInterface.php';
    31 require_once 'Zend/Tool/Framework/Registry/EnabledInterface.php';
    32 
    32 
    33 /**
    33 /**
    34  * @category   Zend
    34  * @category   Zend
    35  * @package    Zend_Tool
    35  * @package    Zend_Tool
    36  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    36  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    37  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    37  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    38  */
    38  */
    39 abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framework_Registry_EnabledInterface
    39 abstract class Zend_Tool_Framework_Client_Abstract implements Zend_Tool_Framework_Registry_EnabledInterface
    40 {
    40 {
    41 
    41 
    59      */
    59      */
    60     protected $_debugLogger = null;
    60     protected $_debugLogger = null;
    61 
    61 
    62     public function __construct($options = array())
    62     public function __construct($options = array())
    63     {
    63     {
    64         // require autoloader 
    64         // require autoloader
    65         Zend_Loader_Autoloader::getInstance();
    65         Zend_Loader_Autoloader::getInstance();
    66 
    66 
    67         // this might look goofy, but this is setting up the
    67         // this might look goofy, but this is setting up the
    68         // registry for dependency injection into the client
    68         // registry for dependency injection into the client
    69         $registry = new Zend_Tool_Framework_Registry();
    69         $registry = new Zend_Tool_Framework_Registry();
    70         $registry->setClient($this);
    70         $registry->setClient($this);
    71 
    71 
    72         // NOTE: at this moment, $this->_registry should contain the registry object
    72         // NOTE: at this moment, $this->_registry should contain the registry object
    73         
    73 
    74         if ($options) {
    74         if ($options) {
    75             $this->setOptions($options);
    75             $this->setOptions($options);
    76         }
    76         }
    77     }
    77     }
    78 
    78 
   108         // run any preInit
   108         // run any preInit
   109         $this->_preInit();
   109         $this->_preInit();
   110 
   110 
   111         $manifest = $this->_registry->getManifestRepository();
   111         $manifest = $this->_registry->getManifestRepository();
   112         $manifest->addManifest(new Zend_Tool_Framework_Client_Manifest());
   112         $manifest->addManifest(new Zend_Tool_Framework_Client_Manifest());
   113         
   113 
   114         // setup the debug log
   114         // setup the debug log
   115         if (!$this->_debugLogger instanceof Zend_Log) {
   115         if (!$this->_debugLogger instanceof Zend_Log) {
   116             require_once 'Zend/Log.php';
   116             require_once 'Zend/Log.php';
   117             require_once 'Zend/Log/Writer/Null.php';
   117             require_once 'Zend/Log/Writer/Null.php';
   118             $this->_debugLogger = new Zend_Log(new Zend_Log_Writer_Null());
   118             $this->_debugLogger = new Zend_Log(new Zend_Log_Writer_Null());
   175     public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry)
   175     public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry)
   176     {
   176     {
   177         $this->_registry = $registry;
   177         $this->_registry = $registry;
   178         return $this;
   178         return $this;
   179     }
   179     }
   180     
   180 
   181     /**
   181     /**
   182      * getRegistry();
   182      * getRegistry();
   183      * 
   183      *
   184      * @return Zend_Tool_Framework_Registry_Interface
   184      * @return Zend_Tool_Framework_Registry_Interface
   185      */
   185      */
   186     public function getRegistry()
   186     public function getRegistry()
   187     {
   187     {
   188         return $this->_registry;
   188         return $this->_registry;
   315             }
   315             }
   316         }
   316         }
   317 
   317 
   318         $this->_handleDispatchExecution($provider, $methodName, $callParameters);
   318         $this->_handleDispatchExecution($provider, $methodName, $callParameters);
   319     }
   319     }
   320     
   320 
   321     protected function _handleDispatchExecution($class, $methodName, $callParameters)
   321     protected function _handleDispatchExecution($class, $methodName, $callParameters)
   322     {
   322     {
   323         if (method_exists($class, $methodName)) {
   323         if (method_exists($class, $methodName)) {
   324             call_user_func_array(array($class, $methodName), $callParameters);
   324             call_user_func_array(array($class, $methodName), $callParameters);
   325         } elseif (method_exists($class, $methodName . 'Action')) {
   325         } elseif (method_exists($class, $methodName . 'Action')) {