Beispiel #1
0
 /**
  * Adds manifest to chain.
  *
  * @param ManifestInterface $manifest
  *
  * @return $this
  */
 public function addManifest(ManifestInterface $manifest)
 {
     $this->manifests[$manifest->getName()] = $manifest;
     return $this;
 }
Beispiel #2
0
 /**
  * @param \FlameCore\Seabreeze\Manifest\ManifestInterface $object
  * @param bool $mustExist
  */
 public function writeManifest(ManifestInterface $object, $mustExist = false)
 {
     $filename = self::makeManifestPath($this->path, "{$object}.json");
     $directory = dirname($filename);
     if (!is_dir($directory)) {
         mkdir($directory, 0755, true);
     }
     if (is_file($filename)) {
         if (!is_writable($filename)) {
             throw new \DomainException(sprintf('Manifest file "%s" unwritable.', $filename));
         }
     } else {
         if ($mustExist) {
             throw new \DomainException(sprintf('Manifest file "%s" missing.', $filename));
         }
     }
     self::writeJson($filename, $object->export());
 }