| @@ 61-100 (lines=40) @@ | ||
| 58 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
| 59 | * @link http://datasift.github.io/storyplayer |
|
| 60 | */ |
|
| 61 | class CreateStory_BasedOnSwitch extends CliSwitch |
|
| 62 | { |
|
| 63 | public function __construct() |
|
| 64 | { |
|
| 65 | // define our name, and our description |
|
| 66 | $this->setName('basedOn'); |
|
| 67 | $this->setShortDescription('base your new story on a StoryTemplate'); |
|
| 68 | ||
| 69 | // what are the short switches? |
|
| 70 | $this->addShortSwitch('b'); |
|
| 71 | ||
| 72 | // what are the long switches? |
|
| 73 | $this->addLongSwitch('based-on'); |
|
| 74 | ||
| 75 | // what is the required argument? |
|
| 76 | $this->setRequiredArg('<classname>', "the StoryTemplate class to base your new story on"); |
|
| 77 | $this->setArgValidator(new MustBeValidStoryTemplate); |
|
| 78 | ||
| 79 | // this argument is repeatable |
|
| 80 | $this->setSwitchIsRepeatable(); |
|
| 81 | ||
| 82 | // all done |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * @param CliEngine $engine |
|
| 87 | * @param integer $invokes |
|
| 88 | * @param array $params |
|
| 89 | * @param boolean $isDefaultParam |
|
| 90 | * @return CliResult |
|
| 91 | */ |
|
| 92 | public function process(CliEngine $engine, $invokes = 1, $params = array(), $isDefaultParam = false) |
|
| 93 | { |
|
| 94 | // remember the setting |
|
| 95 | $engine->options->basedOn = $params; |
|
| 96 | ||
| 97 | // tell the engine that it is done |
|
| 98 | return new CliResult(CliResult::PROCESS_CONTINUE); |
|
| 99 | } |
|
| 100 | } |
|
| @@ 61-100 (lines=40) @@ | ||
| 58 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
| 59 | * @link http://datasift.github.io/storyplayer |
|
| 60 | */ |
|
| 61 | class CreateTestEnv_BasedOnSwitch extends CliSwitch |
|
| 62 | { |
|
| 63 | public function __construct() |
|
| 64 | { |
|
| 65 | // define our name, and our description |
|
| 66 | $this->setName('basedOn'); |
|
| 67 | $this->setShortDescription('base your new test environment on a TestEnvironmentTemplate'); |
|
| 68 | ||
| 69 | // what are the short switches? |
|
| 70 | $this->addShortSwitch('b'); |
|
| 71 | ||
| 72 | // what are the long switches? |
|
| 73 | $this->addLongSwitch('based-on'); |
|
| 74 | ||
| 75 | // what is the required argument? |
|
| 76 | $this->setRequiredArg('<classname>', "the TestEnvironmentTemplate class to base your new test environment on"); |
|
| 77 | $this->setArgValidator(new MustBeValidStoryTemplate); |
|
| 78 | ||
| 79 | // this argument is repeatable |
|
| 80 | $this->setSwitchIsRepeatable(); |
|
| 81 | ||
| 82 | // all done |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * @param CliEngine $engine |
|
| 87 | * @param integer $invokes |
|
| 88 | * @param array $params |
|
| 89 | * @param boolean $isDefaultParam |
|
| 90 | * @return CliResult |
|
| 91 | */ |
|
| 92 | public function process(CliEngine $engine, $invokes = 1, $params = array(), $isDefaultParam = false) |
|
| 93 | { |
|
| 94 | // remember the setting |
|
| 95 | $engine->options->basedOn = $params; |
|
| 96 | ||
| 97 | // tell the engine that it is done |
|
| 98 | return new CliResult(CliResult::PROCESS_CONTINUE); |
|
| 99 | } |
|
| 100 | } |
|
| 101 | ||