/**
  * Verifies that we can set and retrieve the local path.
  */
 public function testLocal()
 {
     self::assertEquals($this->local, $this->event->getLocal());
     self::assertSame($this->event, $this->event->setLocal('to/b.php'));
     self::assertEquals('to/b.php', $this->event->getLocal());
 }
예제 #2
0
 /**
  * Logs when a file is about to be added from a string.
  *
  * @param PreAddFromStringEvent $event The event arguments.
  */
 public function onPreAddFromString(PreAddFromStringEvent $event)
 {
     $this->logger->info(sprintf('The string is about to be added as "%s".', basename($event->getLocal())), array('local' => $event->getLocal()));
 }
예제 #3
0
 /**
  * Processes a file that is about to be added from a string.
  *
  * @param PreAddFromStringEvent $event The event arguments.
  */
 public function onAddFromString(PreAddFromStringEvent $event)
 {
     if ($this->processor->supports($event->getLocal())) {
         $event->setContents($this->processor->process($event->getLocal(), $event->getContents()));
     }
 }
 /**
  * Filters file contents that are about to be added.
  *
  * @param PreAddFromStringEvent $event The event arguments.
  */
 public function onAddFromString(PreAddFromStringEvent $event)
 {
     if (!$this->isAllowed($event->getLocal(), false)) {
         $event->skip();
     }
 }