Returns the new path with the base path extracted.
@param string $path The full path.
@param array $options The array of options.
@return string Returns the new path with the base path removed.
555765
protected function extractPathFromBasePath($path, $options)
    {
        if (isset($options[self::KEY_BASE_PATH])) {
            $pos = strpos($path, $options[self::KEY_BASE_PATH]);
            if (false !== $pos) {
                $path = substr($path, $pos + strlen($options[self::KEY_BASE_PATH]));
            }
        }
        // ensure the path has a leading slash
        if (empty($path) || $path[0] !== '/') {
            $path = '/'.$path;
        }
        return $path;
    }
738155
public function delete($path = '', $options = array())
    {
        return $this->client->delete(
            $this->getPathURI($path),
            $this->addDataToRequest($options),
            $this->requestHeader
        );
    }
1218785
public function extract($path) {

        if (empty($path)) {
            return $this->props;
        }
        // Simple paths.
        if (!preg_match('/[{\[]/', $path)) {
            return (array)$this->get($path);
        }
        if (strpos($path, '[') === false) {
            $tokens = explode('/', $path);
        } else {
            $tokens = $this->_tokenize($path, '/', '[', ']');
        }
        $_key = '__set_item__';
        $context = array($_key => array($this->props));
        foreach ($tokens as $token) {
            $next = array();
            list($token, $conditions) = $this->_splitConditions($token);
            foreach ($context[$_key] as $item) {
                foreach ((array)$item as $k => $v) {
                    if ($this->_matchToken($k, $token)) {
                        $next[] = $v;
                    }
                }
            }
            // Filter for attributes.
            if ($conditions) {
                $filter = array();
                foreach ($next as $item) {
                    if (is_array($item) && $this->_matches($item, $conditions)) {
                        $filter[] = $item;
                    }
                }
                $next = $filter;
            }
            $context = array($_key => $next);
        }
        return $context[$_key];
    }
134220
public function basePath($basePath = null)
    {
        if (!func_num_args()) {
            return $this->_basePath;
        }
        $this->_basePathTmp = $basePath;
        if ($this->_ignorePath) {
            $basePath = preg_replace($this->_ignorePath, '', $basePath);
        }
        $this->_basePath = $basePath && $basePath !== '/' ? '/' . trim($basePath, '/') : '';
        return $this;
    }
1368664
public function resource($path, $options = [])
    {
        $resource = parent::resource($this->converter->pathToId($path));

        return $this->addPathToResource($resource);
    }
478538
public function setBasePath($path) {
		$path = realpath($path);
		
		if ($path === false) {
			throw new NoPath('Path does not exists or is not accessible');
		}
		
		$this->basePath = rtrim($path, DIRECTORY_SEPARATOR);
		
		return $this;
	}
1300808
public function get_path($path)
	{
		$pathinfo = is_dir($path) ? array('dirname' => $path, 'extension' => null, 'basename' => '') : pathinfo($path);

		// make sure we have a dirname to work with
		isset($pathinfo['dirname']) or $pathinfo['dirname'] = '';

		// do we have a basedir, and is the path already prefixed by the basedir? then just deal with the double dots...
		if ( ! empty($this->basedir) && substr($pathinfo['dirname'], 0, strlen($this->basedir)) == $this->basedir)
		{
			$pathinfo['dirname'] = realpath($pathinfo['dirname']);
		}
		else
		{
			// attempt to get the realpath(), otherwise just use path with any double dots taken out when basedir is set (for security)
			$pathinfo['dirname'] = ( ! empty($this->basedir) ? realpath($this->basedir.DS.$pathinfo['dirname']) : realpath($pathinfo['dirname']) )
					?: ( ! empty($this->basedir) ? $this->basedir.DS.str_replace('..', '', $pathinfo['dirname']) : $pathinfo['dirname']);
		}

		// basedir prefix is required when it is set (may cause unexpected errors when realpath doesn't work)
		if ( ! empty($this->basedir) && substr($pathinfo['dirname'], 0, strlen($this->basedir)) != $this->basedir)
		{
			throw new \OutsideAreaException('File operation not allowed: given path is outside the basedir for this area.');
		}

		// check file extension
		if ( ! empty(static::$extensions) && array_key_exists($pathinfo['extension'], static::$extensions))
		{
			throw new \FileAccessException('File operation not allowed: disallowed file extension.');
		}

		return $pathinfo['dirname'].DS.$pathinfo['basename'];
	}
1071699
private function getPath($path)
    {
        return $this->root .
            ltrim(
                preg_replace(
                    sprintf('|%s{2,}|', preg_quote(DIRECTORY_SEPARATOR)),
                    DIRECTORY_SEPARATOR,
                    $path
                ),
                DIRECTORY_SEPARATOR
            );
    }
512115
public function getNode($path)
    {
        if (!is_string($path) || $path[0] !== '/') {
            throw new \InvalidArgumentException('Only absolute paths are allowed for Context::getNode()', 1284975105);
        }

        $path = strtolower($path);

        $workspaceRootNode = $this->getWorkspace()->getRootNodeData();
        $rootNode = $this->nodeFactory->createFromNodeData($workspaceRootNode, $this);
        if ($path !== '/') {
            $node = $this->firstLevelNodeCache->getByPath($path);
            if ($node === false) {
                $node = $rootNode->getNode(substr($path, 1));
                $this->firstLevelNodeCache->setByPath($path, $node);
            }
        } else {
            $node = $rootNode;
        }

        return $node;
    }
562255
public function basePath($basePath = null)
    {
        if (!func_num_args()) {
            return $this->_basePath;
        }
        $this->_basePath = $basePath;
        return $this;
    }
927834
protected function _path($path) {
		return $this->rootName.($path == $this->root ? '' : $this->separator.$this->_relpath($path));
	}
1042301
private function convertPath($path)
    {
        if ($path === null) {
            return null;
        }

        return (new Path($path, $this->baseDir))->toString();
    }
211875
public function url($path, array $params = [])
    {
        $base = true;
        if (isset($params['_base'])) {
            $base = $params['_base'];
            unset($params['_base']);
        }
        $url = $this->urlBuilder()->getUrl($path, $params);
        if ($base && strpos($url, 'http') !== 0) {
            $url = $this->request->getAttribute('webroot') . ltrim($url, '/');
        }

        return $url;
    }
1305109
public static function base($path = '')
    {
        // Check for cached version of base path
        if (null !== self::$base) {
            return self::$base . $path;
        }

        if (isset($_SERVER['HTTP_HOST'])) {
            $base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
            $base_url .= '://' . $_SERVER['HTTP_HOST'];
            $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
            self::$base = $base_url;

            return $base_url . $path;
        }
        return '';
    }
603177
protected function splitPath($path)
    {
        $chunks = array_map(
            [$this, 'unescape'],
            preg_split('#(?<!\\\)\/#', ltrim($path, '/'))
        );

        if (empty($chunks) || (array_filter($chunks) !== $chunks)) {
            throw new \InvalidArgumentException('Invalid path provided:' . $path);
        }

        return $chunks;
    }
1107216
public static function uninstall($path, $options = [])
    {
        $options = array_merge(self::$options, $options);
        if (!self::isValidDestination($path, $options['exclude_checks'])
        ) {
            return false;
        }

        $installer_file_folder = $path;
        $is_install = false;
        $installer = self::loadInstaller($installer_file_folder, $is_install);

        if ($installer && method_exists($installer, 'preUninstall')) {
            $method_result = $installer::preUninstall();
            if ($method_result !== true) {
                self::$error = 'An error occurred';
                if (is_string($method_result)) {
                    self::$error = $method_result;
                }

                return false;
            }
        }

        $result = Folder::delete($path);

        self::$message = '';
        if ($result && $installer && method_exists($installer, 'postUninstall')) {
            self::$message = $installer::postUninstall();
        }

        return $result;
    }
884337
protected function _relpath($path) {
	
		
		$newpath = $path;
		
		
		if (substr($path, 0, 1) != '/') {
			$newpath = "/$newpath";
		}
		
		$newpath =  preg_replace("/\/$/", "", $newpath);
	
		$ret = ($newpath == $this->root) ? '' : substr($newpath, strlen($this->root)+1);
		
		return $ret;
	}