protected function storeAsset()
    {
        if (!$this->visitor instanceof Discover) {
            return;
        }

        $assets = $this->getAssetManager();
        $project_root = $assets->getProjectRoot();
        $asset_path = trim($this->node->parameters);
        $file_path = $this->visitor->getDocument()->getFile()->getRealPath();

        // get source path
        $source = ($asset_path[0] !== '/')
            ? dirname($file_path) . '/' . $asset_path
            : $project_root . $asset_path;

        // get destination path
        $destination = ($asset_path[0] !== '/')
            ? substr(dirname($file_path) . '/' . $asset_path, strlen($project_root))
            : substr($asset_path, 1);

        // set asset
        $assets->set($source, $destination);
    }
protected function storeAsset()
    {
        if (!$this->visitor instanceof Discover) {
            return;
        }

        $assets = $this->getAssetManager();
        $project_root = $assets->getProjectRoot();
        $asset_path = trim($this->node->parameters);
        $file_path = $this->visitor->getDocument()->getFile()->getRealPath();

        // get source path
        $source = ($asset_path[0] !== '/')
            ? dirname($file_path) . '/' . $asset_path
            : $project_root . $asset_path;

        // get destination path
        $destination = ($asset_path[0] !== '/')
            ? substr(dirname($file_path) . '/' . $asset_path, strlen($project_root))
            : substr($asset_path, 1);

        // set asset
        $assets->set($source, $destination);
    }
protected function storeAsset ( ) { if ( ! $ this -> visitor instanceof Discover ) { return ; } $ assets = $ this -> getAssetManager ( ) ; $ project_root = $ assets -> getProjectRoot ( ) ; $ asset_path = trim ( $ this -> node -> parameters ) ; $ file_path = $ this -> visitor -> getDocument ( ) -> getFile ( ) -> getRealPath ( ) ; // get source path $ source = ( $ asset_path [ 0 ] !== '/' ) ? dirname ( $ file_path ) . '/' . $ asset_path : $ project_root . $ asset_path ; // get destination path $ destination = ( $ asset_path [ 0 ] !== '/' ) ? substr ( dirname ( $ file_path ) . '/' . $ asset_path , strlen ( $ project_root ) ) : substr ( $ asset_path , 1 ) ; // set asset $ assets -> set ( $ source , $ destination ) ; }
Stores the asset in the asset manager.

This method takes an asset defined in the directive and stores that in the asset manager.

The following rules apply:

1. The source of the asset is the relative path of the asset prefixed
with a path based on the following rules:

1. If the asset starts with a slash then the path is calculated from the project's root or
2. if the asset does not start with a slash then the path is calculated from the file's directory.

2. the destination of the asset is the path relative to the project root.

1. When the asset starts with a slash then this equals that path without the leading slash.
2. If not, the destination must be calculated by subtracting the project root from the current file's path
and prepending that to the asset path (resolving `../` patterns in the mean time).
Stores the asset in the asset manager .