private function addResource($path, $resource)
    {
        if (!$resource instanceof FilesystemResource && !$resource instanceof LinkResource) {
            throw new UnsupportedResourceException(sprintf(
                'The %s only supports adding FilesystemResource and '.
                'LinkedResource instances. Got: %s',
                // Get the short class name
                $this->getShortClassName(get_class($this)),
                $this->getShortClassName(get_class($resource))
            ));
        }

        if ($resource instanceof LinkResource) {
            $resource = clone $resource;
            $resource->attachTo($this, $path);

            $this->insertReference($path, '@'.$resource->getTargetPath());

            $this->storeVersion($resource);
        } else {
            // Extension point for the optimized repository
            $this->addFilesystemResource($path, $resource);
        }
    }
private function addResource($path, $resource)
    {
        if (!$resource instanceof FilesystemResource && !$resource instanceof LinkResource) {
            throw new UnsupportedResourceException(sprintf(
                'The %s only supports adding FilesystemResource and '.
                'LinkedResource instances. Got: %s',
                // Get the short class name
                $this->getShortClassName(get_class($this)),
                $this->getShortClassName(get_class($resource))
            ));
        }

        if ($resource instanceof LinkResource) {
            $resource = clone $resource;
            $resource->attachTo($this, $path);

            $this->insertReference($path, '@'.$resource->getTargetPath());

            $this->storeVersion($resource);
        } else {
            // Extension point for the optimized repository
            $this->addFilesystemResource($path, $resource);
        }
    }
private function addResource ( $ path , $ resource ) { if ( ! $ resource instanceof FilesystemResource && ! $ resource instanceof LinkResource ) { throw new UnsupportedResourceException ( sprintf ( 'The %s only supports adding FilesystemResource and ' . 'LinkedResource instances. Got: %s' , // Get the short class name $ this -> getShortClassName ( get_class ( $ this ) ) , $ this -> getShortClassName ( get_class ( $ resource ) ) ) ) ; } if ( $ resource instanceof LinkResource ) { $ resource = clone $ resource ; $ resource -> attachTo ( $ this , $ path ) ; $ this -> insertReference ( $ path , '@' . $ resource -> getTargetPath ( ) ) ; $ this -> storeVersion ( $ resource ) ; } else { // Extension point for the optimized repository $ this -> addFilesystemResource ( $ path , $ resource ) ; } }
Adds a resource to the repository.

@param string                          $path     The Puli path to add the
resource at.
@param FilesystemResource|LinkResource $resource The resource to add.
Adds a resource to the repository .