コード例 #1
0
ファイル: Workflow.php プロジェクト: cocur/plum
 /**
  * @param ReaderInterface $reader
  *
  * @return Result
  */
 public function process(ReaderInterface $reader)
 {
     $result = new Result();
     $this->prepareWriters($this->getWriters());
     foreach ($reader as $item) {
         $result->incReadCount();
         try {
             $this->processItem($item, $result);
         } catch (\Exception $e) {
             $result->addException($e);
         }
     }
     $this->finishWriters($this->getWriters());
     return $result;
 }
コード例 #2
0
ファイル: ResultTest.php プロジェクト: cocur/plum
 /**
  * @test
  * @covers Cocur\Plum\Result::incReadCount()
  * @covers Cocur\Plum\Result::getReadCount()
  */
 public function incReadCountShouldIncreaseReadCount()
 {
     $this->result->incReadCount();
     $this->assertEquals(1, $this->result->getReadCount());
 }