You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

13 years ago
<?php
/**
* InlineAction class file.
13 years ago
*
* @link http://www.yiiframework.com/
* @copyright Copyright &copy; 2008-2012 Yii Software LLC
13 years ago
* @license http://www.yiiframework.com/license/
*/
namespace yii\base;
13 years ago
/**
* InlineAction represents an action that is defined as a controller method.
13 years ago
*
* The method name is like 'actionXYZ' where 'XYZ' stands for the action name.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
13 years ago
*/
class InlineAction extends Action
13 years ago
{
/**
* Runs the action.
* This method is invoked by the controller to run the action.
* @param array $params the input parameters
13 years ago
*/
public function run($params)
13 years ago
{
call_user_func_array(array($this->controller, 'action' . $this->id), $params);
13 years ago
}
/**
* Extracts the input parameters according to the signature of the controller action method.
* This method is invoked by controller when it attempts to run the action
* with the user supplied parameters.
* @param array $params the parameters in name-value pairs
* @return array|boolean the extracted parameters in the order as declared in the controller action method.
* False is returned if the input parameters do not follow the method declaration.
13 years ago
*/
public function normalizeParams($params)
13 years ago
{
$method = new \ReflectionMethod($this->controller, 'action' . $this->id);
$params = $this->normalizeParams($method, $params);
if ($params !== false) {
return array($params);
} else {
return false;
}
13 years ago
}
}