Browse Source

renamed method names.

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
7894217cc2
  1. 13
      framework/console/commands/HelpController.php

13
framework/console/commands/HelpController.php

@ -50,7 +50,7 @@ class HelpController extends Controller
public function actionIndex($args = array()) public function actionIndex($args = array())
{ {
if (empty($args)) { if (empty($args)) {
$status = $this->helpIndex(); $status = $this->getHelp();
} else { } else {
$result = \Yii::$application->createController($args[0]); $result = \Yii::$application->createController($args[0]);
if ($result === false) { if ($result === false) {
@ -61,9 +61,9 @@ class HelpController extends Controller
list($controller, $action) = $result; list($controller, $action) = $result;
if ($action === '') { if ($action === '') {
$status = $this->helpController($controller); $status = $this->getControllerHelp($controller);
} else { } else {
$status = $this->helpAction($controller, $action); $status = $this->getActionHelp($controller, $action);
} }
} }
return $status; return $status;
@ -90,6 +90,7 @@ class HelpController extends Controller
$actions = array_keys($controller->actions); $actions = array_keys($controller->actions);
$class = new \ReflectionClass($controller); $class = new \ReflectionClass($controller);
foreach ($class->getMethods() as $method) { foreach ($class->getMethods() as $method) {
/** @var $method \ReflectionMethod */
$name = $method->getName(); $name = $method->getName();
if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0) { if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0) {
$actions[] = lcfirst(substr($name, 6)); $actions[] = lcfirst(substr($name, 6));
@ -140,7 +141,7 @@ class HelpController extends Controller
* Displays all available commands. * Displays all available commands.
* @return integer the exit status * @return integer the exit status
*/ */
protected function helpIndex() protected function getHelp()
{ {
$commands = $this->getCommands(); $commands = $this->getCommands();
if ($commands !== array()) { if ($commands !== array()) {
@ -162,7 +163,7 @@ class HelpController extends Controller
* @param Controller $controller the controller instance * @param Controller $controller the controller instance
* @return integer the exit status * @return integer the exit status
*/ */
protected function helpController($controller) protected function getControllerHelp($controller)
{ {
$class = new \ReflectionClass($controller); $class = new \ReflectionClass($controller);
$comment = strtr(trim(preg_replace('/^\s*\**( |\t)?/m', '', trim($class->getDocComment(), '/'))), "\r", ''); $comment = strtr(trim(preg_replace('/^\s*\**( |\t)?/m', '', trim($class->getDocComment(), '/'))), "\r", '');
@ -213,7 +214,7 @@ class HelpController extends Controller
* @param string $actionID action ID * @param string $actionID action ID
* @return integer the exit status * @return integer the exit status
*/ */
protected function helpAction($controller, $actionID) protected function getActionHelp($controller, $actionID)
{ {
$action = $controller->createAction($actionID); $action = $controller->createAction($actionID);
if ($action === null) { if ($action === null) {

Loading…
Cancel
Save