Exemplo n.º 1
0
 /**
  * Logs when a directory is about to be added.
  *
  * @param PreBuildFromDirectoryEvent $event The event arguments.
  */
 public function onPreBuildFromDirectory(PreBuildFromDirectoryEvent $event)
 {
     $this->logger->info(sprintf('The directory "%s" is about to be added.', basename($event->getPath())), array('filter' => $event->getFilter(), 'path' => $event->getPath()));
 }
 /**
  * Verifies that we can set and retrieve the directory path.
  */
 public function testPath()
 {
     self::assertEquals($this->dir, $this->event->getPath());
     self::assertSame($this->event, $this->event->setPath('/path/to/b'));
     self::assertEquals('/path/to/b', $this->event->getPath());
 }
 /**
  * Filters directories that are about to be added.
  *
  * Internally, `buildFromDirectory()` calls `buildFromIterator()`. This
  * means that this event will only perform a quick check against the path
  * of the directory itself, while `buildFromIterator()` will perform a more
  * thorough check against each entry returned by the iterator.
  *
  * @param PreBuildFromDirectoryEvent $event The event arguments.
  */
 public function onBuildFromDirectory(PreBuildFromDirectoryEvent $event)
 {
     if (!$this->isAllowed($event->getPath(), true)) {
         $event->skip();
     }
 }