Browse Source

Add some PHPDoc notes to AbstractCommand

1.0
Jakub Turek 10 years ago
parent
commit
e4bab08d3f
  1. 55
      Mage/Command/AbstractCommand.php

55
Mage/Command/AbstractCommand.php

@ -26,9 +26,32 @@ abstract class AbstractCommand
*/ */
protected $config = null; protected $config = null;
/**
* Command's help message
*
* @var string
*/
private $helpMessage; private $helpMessage;
private $usageExamples = [];
/**
* Usage examples.
*
* @var array
*/
private $usageExamples = array();
/**
* Command's syntax message
*
* @var string
*/
private $syntaxMessage; private $syntaxMessage;
/**
* Command name
*
* @var string
*/
private $name; private $name;
/** /**
@ -58,6 +81,12 @@ abstract class AbstractCommand
return $this->config; return $this->config;
} }
/**
* Sets command name
*
* @param string $name Command name
* @return $this
*/
public function setName($name) public function setName($name)
{ {
$this->name = $name; $this->name = $name;
@ -65,6 +94,12 @@ abstract class AbstractCommand
return $this; return $this;
} }
/**
* Sets command's help message
*
* @param string $message Command's help message
* @return $this
*/
public function setHelpMessage($message) public function setHelpMessage($message)
{ {
$this->helpMessage = $message; $this->helpMessage = $message;
@ -72,6 +107,13 @@ abstract class AbstractCommand
return $this; return $this;
} }
/**
* Adds command's usage example
*
* @param string $snippet Example's snippet
* @param string $description Example's description
* @return $this
*/
public function addUsageExample($snippet, $description = '') public function addUsageExample($snippet, $description = '')
{ {
array_push($this->usageExamples, [$snippet, $description]); array_push($this->usageExamples, [$snippet, $description]);
@ -79,6 +121,12 @@ abstract class AbstractCommand
return $this; return $this;
} }
/**
* Sets command's syntax message
*
* @param string $message Syntax message
* @return $this
*/
public function setSyntaxMessage($message) public function setSyntaxMessage($message)
{ {
$this->syntaxMessage = $message; $this->syntaxMessage = $message;
@ -86,6 +134,11 @@ abstract class AbstractCommand
return $this; return $this;
} }
/**
* Returns formatted command info
*
* @return string
*/
public function getInfoMessage() public function getInfoMessage()
{ {
$indent = str_repeat(" ", 4); $indent = str_repeat(" ", 4);

Loading…
Cancel
Save