Commit d44f4248 by Alexander Makarov

Fixed getting controller description, refactored a bit more

parent 277d8cba
...@@ -291,11 +291,11 @@ class Controller extends \yii\base\Controller ...@@ -291,11 +291,11 @@ class Controller extends \yii\base\Controller
$class = new \ReflectionClass($this); $class = new \ReflectionClass($this);
} else { } else {
$action = $this->createAction($actionID); $action = $this->createAction($actionID);
$class = new \ReflectionClass($action); if ($action instanceof \yii\base\InlineAction) {
} $class = new \ReflectionMethod($this, $action->actionMethod);
} else {
if ($action instanceof \yii\base\InlineAction) { $class = new \ReflectionClass($action);
$class = new \ReflectionMethod($this, $action->actionMethod); }
} }
$docLines = preg_split('~\R~', $class->getDocComment()); $docLines = preg_split('~\R~', $class->getDocComment());
...@@ -320,11 +320,13 @@ class Controller extends \yii\base\Controller ...@@ -320,11 +320,13 @@ class Controller extends \yii\base\Controller
if ($actionID === null) { if ($actionID === null) {
$class = new \ReflectionClass($this); $class = new \ReflectionClass($this);
} else { } else {
$class = new \ReflectionClass($this->createAction($actionID)); $action = $this->createAction($actionID);
}
if ($action instanceof \yii\base\InlineAction) { if ($action instanceof \yii\base\InlineAction) {
$class = new \ReflectionMethod($this, $action->actionMethod); $class = new \ReflectionMethod($this, $action->actionMethod);
} else {
$class = new \ReflectionClass($action);
}
} }
$comment = strtr(trim(preg_replace('/^\s*\**( |\t)?/m', '', trim($class->getDocComment(), '/'))), "\r", ''); $comment = strtr(trim(preg_replace('/^\s*\**( |\t)?/m', '', trim($class->getDocComment(), '/'))), "\r", '');
......
...@@ -40,7 +40,7 @@ class HelpController extends Controller ...@@ -40,7 +40,7 @@ class HelpController extends Controller
{ {
/** /**
* Displays available commands or the detailed information * 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. * @param string $command The name of the command to show help about.
* If not provided, all available commands will be displayed. * If not provided, all available commands will be displayed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment