Пример #1
0
 private function createDescription()
 {
     $cmd = Cli::getScriptName();
     $description = $this->task->getDescription();
     $version = 'version ' . $this->task->getVersion();
     $header = $this->createHeader('name', " @[bold]{$cmd}@[reset] {$version}");
     return "{$header} {$description}\n";
 }
Пример #2
0
 /**
  * Run a task
  *
  * @param mixed $data
  */
 public function run($data)
 {
     $this->task->addValues($data);
     if ($this->task->validate() === true) {
         return $this->task->run();
     }
     $errors = $this->task->getErrors();
     Env::error($this->formatErrors($errors));
 }
Пример #3
0
 /**
  * Constructor
  * 
  * @param string $classname The name of a task class
  * @param array.<sndsgd\Field> $fields Fields to inject into the task
  */
 public function __construct($classname, array $fields = [])
 {
     if (Task::validateClassname($classname) === false) {
         throw new InvalidArgumentException("invalid value provided for 'classname'; expecting the name of " . "a subclass of sndsgd\\Task as string");
     }
     $this->task = new $classname($fields);
 }
Пример #4
0
 /**
  * Constructor
  *
  * @param sndsgd\Task $task A task instance to generate a help page for
  */
 public function __construct(Task $task)
 {
     $this->task = $task;
     $this->fields = $task->getFields();
 }