Пример #1
0
 /**
  * @param mixed  $item
  * @param Result $result
  *
  * @return void
  */
 protected function processItem($item, Result $result)
 {
     $written = false;
     foreach ($this->pipeline as $element) {
         if ($element[0] === self::PIPELINE_TYPE_FILTER) {
             if ($element[1]->filter($item) === false) {
                 return;
             }
         } else {
             if ($element[0] === self::PIPELINE_TYPE_CONVERTER) {
                 $item = $this->convertItem($item, $element[1], $element[2]);
             } else {
                 if ($element[0] === self::PIPELINE_TYPE_WRITER) {
                     if ($this->writeItem($item, $element[1], $element[2]) === true) {
                         $result->incWriteCount();
                         $written = true;
                     }
                 }
             }
         }
     }
     if ($written === true) {
         $result->incItemWriteCount();
     }
 }
Пример #2
0
 /**
  * @test
  * @covers Cocur\Plum\Result::incWriteCount()
  * @covers Cocur\Plum\Result::getWriteCount()
  */
 public function incWriteCountShouldIncreaseWriteCount()
 {
     $this->result->incWriteCount();
     $this->assertEquals(1, $this->result->getWriteCount());
 }