Adding performance optimizations to dispatch cycle

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6570 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-03-15 05:04:36 +00:00
parent 49a092f1d0
commit a9378fb681
3 changed files with 12 additions and 25 deletions

View file

@ -147,14 +147,13 @@ class Dispatcher extends Object {
)
));
}
$missingAction = $missingView = $privateAction = false;
if (empty($this->params['action'])) {
$this->params['action'] = 'index';
}
$prefixes = Router::prefixes();
if (!empty($prefixes)) {
if (isset($this->params['prefix'])) {
$this->params['action'] = $this->params['prefix'] . '_' . $this->params['action'];

View file

@ -100,7 +100,8 @@ class Component extends Object {
'className' => $this->controller->name,
'component' => $component,
'file' => Inflector::underscore($component) . '.php',
'base' => $this->controller->base
'base' => $this->controller->base,
'code' => 500
)));
return false;
}
@ -111,7 +112,8 @@ class Component extends Object {
'className' => $this->controller->name,
'component' => $component,
'file' => Inflector::underscore($component) . '.php',
'base' => $this->controller->base
'base' => $this->controller->base,
'code' => 500
)));
return false;
}

View file

@ -105,25 +105,13 @@ class Object {
*
* @param string $method Name of the method to call
* @param array $params Parameter list to use when calling $method
* @param boolean $strict If true, checks to make sure that $method is defined
* in this object. Throws a warning if not.
* @return mixed Returns the result of the method call, or null if $strict is
* true and the method was not found
* @return mixed Returns the result of the method call
* @access public
*/
function dispatchMethod($method, $params = array(), $strict = false) {
if ($strict) {
if (!method_exists($this, $method)) {
trigger_error("Object::dispatchMethod() - Method {$method} not found in " . get_class($this), E_USER_WARNING);
return null;
}
}
if (empty($params)) {
return $this->{$method}();
}
$params = array_values($params);
function dispatchMethod($method, $params = array()) {
switch (count($params)) {
case 0:
return $this->{$method}();
case 1:
return $this->{$method}($params[0]);
case 2:
@ -150,11 +138,9 @@ class Object {
if (!class_exists('CakeLog')) {
uses('cake_log');
}
if (is_null($this->_log)) {
$this->_log = new CakeLog();
}
if (!is_string($msg)) {
$msg = print_r($msg, true);
}