Hi,

let's look at the code of the method __call() of the Zend_Controller_Action:

    public function __call($methodName, $args)
    {
        if ('Action' == substr($methodName, -6)) {
            require_once 'Zend/Controller/Action/Exception.php';
            $action = substr($methodName, 0, strlen($methodName) - 6);
            require_once 'Zend/Controller/Action/Exception.php';
            throw new Zend_Controller_Action_Exception(sprintf('Action "%s"
does not exist and was not trapped in __call()', $action), 404);
        }

        require_once 'Zend/Controller/Action/Exception.php';
        throw new Zend_Controller_Action_Exception(sprintf('Method "%s" does
not exist and was not trapped in __call()', $methodName), 500);
    }

the require_once 'Zend/Controller/Action/Exception.php' statement appear
here three times,it is better like following:

    public function __call($methodName, $args)
    {
        require_once 'Zend/Controller/Action/Exception.php';

        if ('Action' == substr($methodName, -6)) {
            $action = substr($methodName, 0, strlen($methodName) - 6);
            throw new Zend_Controller_Action_Exception(sprintf('Action "%s"
does not exist and was not trapped in __call()', $action), 404);
        }

        throw new Zend_Controller_Action_Exception(sprintf('Method "%s" does
not exist and was not trapped in __call()', $methodName), 500);
    }

Reply via email to