當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Result::getData方法代碼示例

本文整理匯總了PHP中Robo\Result::getData方法的典型用法代碼示例。如果您正苦於以下問題:PHP Result::getData方法的具體用法?PHP Result::getData怎麽用?PHP Result::getData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Robo\Result的用法示例。


在下文中一共展示了Result::getData方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testBasics

 public function testBasics()
 {
     $task = new ResultDummyTask();
     $result = new Result($task, 1, 'The foo barred', ['time' => 0]);
     $this->guy->seeInOutput('The foo barred');
     $this->guy->seeInOutput('Error');
     $this->guy->seeInOutput('[ResultDummyTask]');
     $this->assertSame($task, $result->getTask());
     $this->assertEquals(1, $result->getExitCode());
     $this->assertEquals('The foo barred', $result->getMessage());
     $this->assertEquals(['time' => 0], $result->getData());
     $taskClone = $result->cloneTask();
     $this->assertNotSame($task, $taskClone);
     $this->assertInstanceOf('Robo\\Task\\Shared\\TaskInterface', $taskClone);
 }
開發者ID:sliver,項目名稱:Robo,代碼行數:15,代碼來源:ResultTest.php

示例2: runTaskList

 /**
  * Run every task in a list, but only up to the first failure.
  * Return the failing result, or success if all tasks run.
  *
  * @param string $name
  * @param TaskInterface[] $taskList
  * @param \Robo\Result $result
  *
  * @return \Robo\Result
  *
  * @throws \Robo\Exception\TaskExitException
  */
 private function runTaskList($name, array $taskList, Result $result)
 {
     try {
         foreach ($taskList as $taskName => $task) {
             $taskResult = $this->runSubtask($task);
             $this->advanceProgressIndicator();
             // If the current task returns an error code, then stop
             // execution and signal a rollback.
             if (!$taskResult->wasSuccessful()) {
                 return $taskResult;
             }
             // We accumulate our results into a field so that tasks that
             // have a reference to the collection may examine and modify
             // the incremental results, if they wish.
             $key = Result::isUnnamed($taskName) ? $name : $taskName;
             $result->accumulate($key, $taskResult);
         }
     } catch (TaskExitException $exitException) {
         $this->fail();
         throw $exitException;
     } catch (\Exception $e) {
         // Tasks typically should not throw, but if one does, we will
         // convert it into an error and roll back.
         return Result::fromException($task, $e, $result->getData());
     }
     return $result;
 }
開發者ID:jjok,項目名稱:Robo,代碼行數:39,代碼來源:Collection.php

示例3: merge

 /**
  * Merge another result into this result.  Data already
  * existing in this result takes precedence over the
  * data in the Result being merged.
  */
 public function merge(Result $result)
 {
     $this->data += $result->getData();
     return $this;
 }
開發者ID:zondor,項目名稱:Robo,代碼行數:10,代碼來源:Result.php


注:本文中的Robo\Result::getData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。