/** * Verifies that we can set and retrieve the path. * * @covers \Box\Component\Builder\Event\PostAddEmptyDirEvent * @covers \Box\Component\Builder\Event\PreAddEmptyDirEvent */ public function testPath() { $event = new PreAddEmptyDirEvent($this->builder, '/path/to/a'); self::assertEquals('/path/to/a', $event->getLocal()); self::assertSame($event, $event->setLocal('/path/to/b')); self::assertEquals('/path/to/b', $event->getLocal()); }
/** * Logs when an empty directory is about to be added. * * @param PreAddEmptyDirEvent $event The event arguments. */ public function onPreAddEmptyDir(PreAddEmptyDirEvent $event) { $this->logger->info(sprintf('The empty directory "%s" is about to be added.', basename($event->getLocal())), array('local' => $event->getLocal())); }
/** * Filters empty directories that are about to be added. * * @param PreAddEmptyDirEvent $event The event arguments. */ public function onAddEmptyDir(PreAddEmptyDirEvent $event) { if (!$this->isAllowed($event->getLocal(), true)) { $event->skip(); } }