/** * Adds a file from a string to the archive. * * @param string $local The path to the file in the archive. * @param string $contents The contents of the file. */ public function addFromString($local, $contents = null) { if (null === $this->dispatcher) { parent::addFromString($local, $contents); return; } $event = new PreAddFromStringEvent($this, $local, $contents); $this->dispatcher->dispatch(Events::PRE_ADD_FROM_STRING, $event); if (!$event->isSkipped()) { parent::addFromString($event->getLocal(), $event->getContents()); $event = new PostAddFromStringEvent($this, $event->getLocal(), $event->getContents()); $this->dispatcher->dispatch(Events::POST_ADD_FROM_STRING, $event); } }