/**
  * Verifies that we can set and retrieve the iterator.
  */
 public function testIterator()
 {
     $iterator = new ArrayIterator(array());
     self::assertSame($this->iterator, $this->event->getIterator());
     self::assertSame($this->event, $this->event->setIterator($iterator));
     self::assertSame($iterator, $this->event->getIterator());
 }
Example #2
0
 /**
  * Logs when all of the items from an iterator are about to be added.
  *
  * @param PreBuildFromIteratorEvent $event The event arguments.
  */
 public function onPreBuildFromIterator(PreBuildFromIteratorEvent $event)
 {
     $base = explode('\\', get_class($event->getIterator()));
     $base = array_pop($base);
     $this->logger->info(sprintf('The items from the "%s" iterator are about to be added.', $base), array('base' => $event->getBase(), 'class' => get_class($event->getIterator())));
     $event->setIterator(new LoggerIterator($event->getIterator(), $this->logger));
 }
 /**
  * Processes files from an iterator as they are added.
  *
  * @param PreBuildFromIteratorEvent $event The event arguments.
  */
 public function onBuildFromIterator(PreBuildFromIteratorEvent $event)
 {
     $event->setIterator(new ProcessorIterator($event->getIterator(), $this->processor, $event->getBase()));
 }
 /**
  * Filters files and directories from iterators that are about to be added.
  *
  * @param PreBuildFromIteratorEvent $event The event arguments.
  */
 public function onBuildFromIterator(PreBuildFromIteratorEvent $event)
 {
     $event->setIterator(new FilterIterator($event->getIterator(), $this));
 }