/** * Sets the information for a path. * * If a compression mode other than `NONE` is set, the file contents are * automatically compressed using the respective compression scheme. * * @param string $path The name of the path. * @param PathInterface $manager The path manager. */ public function setPath($path, PathInterface $manager) { $this->replace('paths', ['path' => $path, 'type' => $manager->getType(), 'compression' => $this->compression, 'modified' => $manager->getModified(), 'permissions' => $manager->getPermissions(), 'contents' => $this->compress($manager->getContents())]); }
/** * Extracts a file path. * * @param string $path The path to create. * @param PathInterface $manager The path manager. * * @throws SqonException If the file could not be extracted. */ private function extractFile($path, PathInterface $manager) { $dir = dirname($path); if (!is_dir($dir) && !mkdir($dir, 0755, true)) { // @codeCoverageIgnoreStart throw new SqonException("The directory \"{$dir}\" could not be created."); // @codeCoverageIgnoreEnd } if (false === file_put_contents($path, $manager->getContents())) { // @codeCoverageIgnoreStart throw new SqonException("The file \"{$path}\" could not be written."); // @codeCoverageIgnoreEnd } $this->setAttributes($path, $manager); }