Adds a filesystem resource to the JSON file.

@param string             $path     The Puli path.
@param FilesystemResource $resource The resource to add.
499510
protected function addFilesystemResource($path, FilesystemResource $resource)
    {
        $resource = clone $resource;
        $resource->attachTo($this, $path);

        $relativePath = Path::makeRelative($resource->getFilesystemPath(), $this->baseDirectory);

        $this->insertReference($path, $relativePath);

        $this->storeVersion($resource);
    }
215303
public  function addClassPath($path) {
        if(!is_array($path)) {
            $path = array($path);
        }
        foreach($path as $item) {
            $this->classPaths[] = $item;
        }
    }
1120057
protected function addResource($resource)
    {
        $resource = trim($resource);
        if (strlen($resource)) {
            $this->resources[] = $resource;
        }
    }
1135916
public function addPath($path)
    {
        // just force to array
        settype($path, 'array');

        // loop through the path directories
        foreach ($path as $dir) {
            // no surrounding spaces allowed!
            $dir = trim($dir);

            // remove trailing slash
            if (substr($dir, -1) == DIRECTORY_SEPARATOR) {
                $dir = substr_replace($dir, '', -1);
            }

            // add to the top of the search dirs
            array_unshift($this->_paths, $dir);
        }
    }
1011331
protected function buildPathFromArray($path, Filesystem $filesystem = null)
    {
        $pathArray = collect(explode('/', $path))->prepend('resources');

        if (is_null($filesystem)) {
            $filesystem = new Filesystem();
        }

        $base = base_path();

        foreach ($pathArray as $path) {
            $base = $base.'/'.$path;

            if (!$filesystem->exists($base)) {
                $filesystem->makeDirectory($base);
            }
        }
    }
977853
def add_resource(self, resource):
        ''''''
        resource.validate()
        self.update(__raw__={
            '$push': {
                'resources': {
                    '$each': [resource.to_mongo()],
                    '$position': 0
                }
            }
        })
        self.reload()
        post_save.send(self.__class__, document=self,
                       resource_added=resource.id)
585947
protected function patchResource($path)
    {
        $resourceName = strtolower($this->model);
        $ref = "->arrayNode('$resourceName')";

        if ($this->refExist($path, $ref)) {
            return;
        }

        $ref = "->arrayNode('classes')
                    ->addDefaultsIfNotSet()
                    ->children()";

        $nodeDeclaration = <<<EOF
                        ->arrayNode('$resourceName')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->scalarNode('model')
                                ->end()
                                ->scalarNode('controller')
                                ->end()
                                ->scalarNode('form')
                                ->end()
                            ->end()
                        ->end()
EOF;

        $this->dumpFile($path, "\n" . $nodeDeclaration, $ref);
    }
344202
public static function add( $key, $path, $url = null )
	{
		static::$paths[$key] = $path;
		
		if ( !is_null( $url ) )
		{
			static::$urls[$key] = $url;
		}
	}
1025835
public function addFolder(string $path)
    {
        if (!\is_dir($path)) {
            throw new \RuntimeException(\sprintf('The path "%s" does not exist or is not a directory.', $path));
        }
        $this->paths[] = $path;
    }
133425
public function addRootFile($path){
		$rootFile = $this->dom->rootfiles->addChild('rootfile');
		$rootFile['full-path'] = $path;
		$rootFile['media-type'] = 'application/oebps-package+xml';
	}
680352
public function zipResourceFile($file, $resource)
    {
        if (!$this->zip->addFromString($file, json_encode($resource, JSON_UNESCAPED_SLASHES))) {
            throw new InternalServerErrorException("Failed to add $file to the Zip Archive.");
        }
    }
137222
public function addResource(ResourceInterface $resource)
    {
        $key = (string) $resource;

        if (!isset($this->resources[$key])) {
            $this->resources[$key] = $resource;
        }
    }
402189
public function addResource(string $file): void
    {
        $contents = file_get_contents($file);
        
        if ($contents === false) {
            throw new \RuntimeException("Error reading file at $file.");
        }
        
        $this->processData(json_decode($contents, true));
    }
366750
public static function addPath ($path, $namespace = \Twig_Loader_Filesystem::MAIN_NAMESPACE)
    {
        $twigLoader = self::getTwigLoader();
        /* @var $twigLoader \Twig_Loader_Filesystem */
        $twigLoader->addPath($path, $namespace);
    }
1201453
public static void addFolder(Path p, JsonArray succeeded, JsonArray failed) throws IOException {
    FileSystem fs = FileSystem.get(p.toUri(), PersistHdfs.CONF);
    if(!fs.exists(p)){
      JsonObject o = new JsonObject();
      o.addProperty(Constants.FILE, p.toString());
      o.addProperty(Constants.ERROR, "Path does not exist!");
      failed.add(o);
      return;
    }
    addFolder(fs, p, succeeded, failed);
  }
420091
public function fill_included_resources($resources) {
	if ($resources instanceof \alsvanzelf\jsonapi\collection) {
		$resources = $resources->get_resources();
	}
	
	foreach ($resources as $resource) {
		$this->add_included_resource($resource);
	}
}
77084
public static function getResource($path, $resource = 'Resource')
    {
        $response = self::connection()->get(self::$api_path . $path);

        return self::mapResource($resource, $response);
    }