Puli\Repository\InMemoryRepository::addResource PHP Method

addResource() private method

private addResource ( $path, Puli\Repository\Api\Resource\PuliResource $resource )
$resource Puli\Repository\Api\Resource\PuliResource
    private function addResource($path, PuliResource $resource)
    {
        $basePath = '/' === $path ? $path : $path . '/';
        // Read children before attaching the resource to this repository
        $children = $resource->listChildren();
        $resource = clone $resource;
        $resource->attachTo($this, $path);
        // Add the resource before adding its children, so that the array
        // stays sorted
        $this->resources[$path] = $resource;
        foreach ($children as $name => $child) {
            $this->addResource($basePath . $name, $child);
        }
        $this->storeVersion($resource);
    }