public function setPath($name, $value, $applyToResolver = true)
    {
        if ($applyToResolver && $this->callerNotSelfOrChild()) {
            Deprecated::method(3.3, 'Use Bolt\Filesystem (recommended) or PathResolver::resolve instead.');
        }

        if (strpos($value, '%') !== false) { // contains variable
            $path = function () use ($value) {
                if (!$this->pathResolver) {
                    throw new \LogicException(sprintf('Cannot resolve path "%s" without having a path resolver.', $value));
                }

                $path = $this->pathResolver->resolve($value);

                return $this->pathManager->create($path);
            };
        } else {
            // If this is a relative path make it relative to root.
            $path = $this->pathManager->create($value);
            if ($path instanceof RelativePathInterface) {
                $path = $path->resolveAgainst($this->paths['root']);
            }

            $path = $path->normalize();
        }

        $this->paths[$name] = $path;
        if (strpos($name, 'path') === false) {
            $this->paths[$name . 'path'] = $path;
        }

        if ($applyToResolver) {
            if ($this->pathResolver) {
                $this->pathResolver->define($name, $value);
            } else {
                $this->pathResolverFactory->addPaths([$name => $value]);
            }
        }

        return $path;
    }
public function setPath($name, $value, $applyToResolver = true)
    {
        if ($applyToResolver && $this->callerNotSelfOrChild()) {
            Deprecated::method(3.3, 'Use Bolt\Filesystem (recommended) or PathResolver::resolve instead.');
        }

        if (strpos($value, '%') !== false) { // contains variable
            $path = function () use ($value) {
                if (!$this->pathResolver) {
                    throw new \LogicException(sprintf('Cannot resolve path "%s" without having a path resolver.', $value));
                }

                $path = $this->pathResolver->resolve($value);

                return $this->pathManager->create($path);
            };
        } else {
            // If this is a relative path make it relative to root.
            $path = $this->pathManager->create($value);
            if ($path instanceof RelativePathInterface) {
                $path = $path->resolveAgainst($this->paths['root']);
            }

            $path = $path->normalize();
        }

        $this->paths[$name] = $path;
        if (strpos($name, 'path') === false) {
            $this->paths[$name . 'path'] = $path;
        }

        if ($applyToResolver) {
            if ($this->pathResolver) {
                $this->pathResolver->define($name, $value);
            } else {
                $this->pathResolverFactory->addPaths([$name => $value]);
            }
        }

        return $path;
    }
public function setPath ( $ name , $ value , $ applyToResolver = true ) { if ( $ applyToResolver && $ this -> callerNotSelfOrChild ( ) ) { Deprecated :: method ( 3.3 , 'Use Bolt\Filesystem (recommended) or PathResolver::resolve instead.' ) ; } if ( strpos ( $ value , '%' ) !== false ) { // contains variable $ path = function ( ) use ( $ value ) { if ( ! $ this -> pathResolver ) { throw new \ LogicException ( sprintf ( 'Cannot resolve path "%s" without having a path resolver.' , $ value ) ) ; } $ path = $ this -> pathResolver -> resolve ( $ value ) ; return $ this -> pathManager -> create ( $ path ) ; } ; } else { // If this is a relative path make it relative to root. $ path = $ this -> pathManager -> create ( $ value ) ; if ( $ path instanceof RelativePathInterface ) { $ path = $ path -> resolveAgainst ( $ this -> paths [ 'root' ] ) ; } $ path = $ path -> normalize ( ) ; } $ this -> paths [ $ name ] = $ path ; if ( strpos ( $ name , 'path' ) === false ) { $ this -> paths [ $ name . 'path' ] = $ path ; } if ( $ applyToResolver ) { if ( $ this -> pathResolver ) { $ this -> pathResolver -> define ( $ name , $ value ) ; } else { $ this -> pathResolverFactory -> addPaths ( [ $ name => $ value ] ) ; } } return $ path ; }
Set a resource path.

@param string $name
@param string $value
@param bool   $applyToResolver

@return AbsolutePathInterface|RelativePathInterface|\Closure
Set a resource path .