Yii2 Bootstrap 3
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.

50 lines
1.5 KiB

13 years ago
<?php
/**
13 years ago
* Controller 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\console;
13 years ago
use yii\base\Action;
13 years ago
use yii\base\Exception;
13 years ago
/**
13 years ago
* Controller is the base class of console command classes.
13 years ago
*
13 years ago
* A controller consists of one or several actions known as sub-commands.
* Users call a console command by specifying the corresponding route which identifies a controller action.
* The `yiic` program is used when calling a console command, like the following:
13 years ago
*
13 years ago
* ~~~
* yiic <route> [...options...]
* ~~~
13 years ago
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
13 years ago
class Controller extends \yii\base\Controller
13 years ago
{
/**
13 years ago
* This method is invoked when extra parameters are provided to an action when it is executed.
* The default implementation does nothing.
* @param Action $action the action being executed
* @param array $expected the expected action parameters (name => value)
* @param array $actual the actual action parameters (name => value)
13 years ago
* @throws Exception if any unrecognized parameters are provided
13 years ago
*/
public function extraActionParams($action, $expected, $actual)
{
13 years ago
unset($expected['args'], $actual['args']);
13 years ago
$keys = array_diff(array_keys($actual), array_keys($expected));
if (!empty($keys)) {
throw new Exception(\Yii::t('yii', 'Unknown parameters: {params}', array(
'{params}' => implode(', ', $keys),
)));
13 years ago
}
}
}