コード例 #1
0
 /**
  * Log the result of a Robo task.
  *
  * Returns 'true' if the message is printed, or false if it isn't.
  *
  * @return boolean
  */
 public function printResult(Result $result)
 {
     if (!$result->wasSuccessful()) {
         return $this->printError($result);
     } else {
         return $this->printSuccess($result);
     }
 }
コード例 #2
0
ファイル: TaskForEach.php プロジェクト: jjok/Robo
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $finalResult = Result::success($this);
     $this->startProgressIndicator();
     foreach ($this->iterable as $key => $value) {
         $this->showIterationMessage($key, $value);
         try {
             foreach ($this->functionStack as $fn) {
                 $result = call_user_func($fn, $key, $value);
                 $this->advanceProgressIndicator();
                 if (!isset($result)) {
                     $result = Result::success($this);
                 }
                 // If the function returns a result, it must either return
                 // a \Robo\Result or an exit code.  In the later case, we
                 // convert it to a \Robo\Result.
                 if (!$result instanceof Result) {
                     $result = new Result($this, $result);
                 }
                 if (!$result->wasSuccessful()) {
                     return $result;
                 }
                 $finalResult = $result->merge($finalResult);
             }
         } catch (\Exception $e) {
             return Result::fromException($result, $e);
         }
     }
     $this->stopProgressIndicator();
     return $finalResult;
 }