-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #65: Allow commands to call other commands #65
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,11 @@ class CommandInfo | |
*/ | ||
protected $optionParamName; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $calls = []; | ||
|
||
/** | ||
* Create a new CommandInfo class for a particular method of a class. | ||
* | ||
|
@@ -333,6 +338,25 @@ public function getTopics() | |
return explode(',', trim($topics)); | ||
} | ||
|
||
/** | ||
* Returns an array of commands that this command calls. | ||
* | ||
* @return string[] | ||
*/ | ||
public function getCalls() | ||
{ | ||
return $this->calls; | ||
} | ||
|
||
public function setCalls($calls) { | ||
if (is_string($calls)) { | ||
$calls = explode(',', static::convertListToCommaSeparated($calls)); | ||
} | ||
$this->calls = array_filter($calls); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe array-merge these together, so folks can use multiple There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I'd prefer that. I briefly attempted this but wasn't quite sure how to access multiple |
||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Return the list of refleaction parameters. | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ abstract class AbstractCommandDocBlockParser | |
'usage' => 'processUsageTag', | ||
'description' => 'processAlternateDescriptionTag', | ||
'desc' => 'processAlternateDescriptionTag', | ||
'calls' => 'processCalls', | ||
]; | ||
|
||
public function __construct(CommandInfo $commandInfo, \ReflectionMethod $reflection) | ||
|
@@ -168,6 +169,14 @@ protected function processAliases($tag) | |
$this->commandInfo->setAliases((string)$tag->getDescription()); | ||
} | ||
|
||
/** | ||
* Process the comma-separated list of commands to call. | ||
*/ | ||
protected function processCalls($tag) | ||
{ | ||
$this->commandInfo->setCalls((string)$tag->getDescription()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there are multiple @Calls annotations, this function will be called multiple times. Currently, this implementation overwrites via |
||
} | ||
|
||
/** | ||
* Store the data from a @param annotation in our argument descriptions. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a logging mechanism available?