Fixed getting controller description, refactored a bit more

This commit is contained in:
Alexander Makarov
2014-09-04 03:14:36 +04:00
parent 277d8cbaeb
commit d44f424858
2 changed files with 12 additions and 10 deletions

View File

@ -291,11 +291,11 @@ class Controller extends \yii\base\Controller
$class = new \ReflectionClass($this);
} else {
$action = $this->createAction($actionID);
$class = new \ReflectionClass($action);
}
if ($action instanceof \yii\base\InlineAction) {
$class = new \ReflectionMethod($this, $action->actionMethod);
if ($action instanceof \yii\base\InlineAction) {
$class = new \ReflectionMethod($this, $action->actionMethod);
} else {
$class = new \ReflectionClass($action);
}
}
$docLines = preg_split('~\R~', $class->getDocComment());
@ -320,11 +320,13 @@ class Controller extends \yii\base\Controller
if ($actionID === null) {
$class = new \ReflectionClass($this);
} else {
$class = new \ReflectionClass($this->createAction($actionID));
}
$action = $this->createAction($actionID);
if ($action instanceof \yii\base\InlineAction) {
$class = new \ReflectionMethod($this, $action->actionMethod);
if ($action instanceof \yii\base\InlineAction) {
$class = new \ReflectionMethod($this, $action->actionMethod);
} else {
$class = new \ReflectionClass($action);
}
}
$comment = strtr(trim(preg_replace('/^\s*\**( |\t)?/m', '', trim($class->getDocComment(), '/'))), "\r", '');

View File

@ -40,7 +40,7 @@ class HelpController extends Controller
{
/**
* Displays available commands or the detailed information
* about a particular command. For example,
* about a particular command.
*
* @param string $command The name of the command to show help about.
* If not provided, all available commands will be displayed.