Sets or gets the current session save path.

@param string|null $path

@throws \InvalidArgumentException
@return string the current session save path.
964299
public function savePath($path = null)
    {
        if ($path === null) {
            return session_save_path();
        }
        if ($this->isOpen) {
            throw new \InvalidArgumentException('The session has already been opened.');
        }
        if (!is_string($path)) {
            throw new \InvalidArgumentException('Session path must be null or a string');
        }
        if (!is_dir($path)) {
            throw new \InvalidArgumentException("Path not found: {$path}");
        }
        session_save_path($path);
    }
460768
public function loadFile($path)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException(
                'File must be a string'
            );
        }

        if (!file_exists($path)) {
            throw new InvalidArgumentException(
                sprintf('File "%s" does not exist', $path)
            );
        }

        $ext = pathinfo($path, PATHINFO_EXTENSION);
        switch ($ext) {
            case 'php':
                return $this->loadPhpFile($path);

            case 'json':
                return $this->loadJsonFile($path);

            case 'ini':
                return $this->loadIniFile($path);

            case 'yml':
            case 'yaml':
                return $this->loadYamlFile($path);
        }

        $validConfigExts = [ 'ini', 'json', 'php', 'yml' ];
        throw new InvalidArgumentException(sprintf(
            'Unsupported file format for "%s"; must be one of "%s"',
            $path,
            implode('", "', $validConfigExts)
        ));
    }
524729
public function relPath($path = null)
    {
        # Cleaning path
        $path = preg_replace('/^\//', '', $path);

        return str_replace(public_path(), '', $this->getCurrentPath() . '/' . $path);
    }
713790
protected function _getAbsoluteRemotePath($path = null)
    {
        if (null === $path) {
            return $this->_startingpath;
        }

        $path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
        if (null === $parse_url = @parse_url($path)) {
            $parse_url = array('path' => $path);
        }

        return ('/' === substr($parse_url['path'], 0, 1) ? $path : $this->_remotepath.'/'.$path);
    }
885388
public function setPath(string $path = null)
    {
        if ($path === null) {
            $uri = $this->server->get('REQUEST_URI');

            if (empty($uri)) {
                // Default to a slash
                $this->path = '/';
            } else {
                $uriParts = explode('?', $uri);
                $this->path = $uriParts[0];
            }
        } else {
            $this->path = $path;
        }
    }
443484
public function setPath($path)
    {
        if (!file_exists($path) || !is_dir($path)) {
            throw new \InvalidArgumentException(
                'Expected the template path to be an existing directory, received: '.$path
            );
        }

        $this->path = $path;
    }
497686
public function getReference(string $path = null): Reference
    {
        try {
            return new Reference($this->uri->withPath($path ?? ''), $this->client);
        } catch (\InvalidArgumentException $e) {
            throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
        }
    }
748794
protected function _prepareFilePath($path = null) {
		if (empty($path)) {
			return false;
		}

		if (DIRECTORY_SEPARATOR !== '\\') {
			return $path;
		}

		$path = str_replace('\\', '/', $path);

		return $path;
	}
89064
public function path($path = null)
    {
        if (!func_num_args()) {
            return $this->_path;
        }
        $this->_path = '/' . ltrim($path, '/');
        return $this;
    }
499763
public function set($path)
	{
		if (! is_string($path)) {
			throw new \InvalidArgumentException();
		}
		if ($path === '') {
			$this->setParts([]);
		} else {
			$this->setParts(explode('/', $path));
		}
		return $this;
	}
481380
private function resolvePath($path)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException(
                'Path needs to be a string'
            );
        }

        $basePath = $this->basePath();
        $path = trim($path, '/\\');

        if ($basePath && strpos($path, $basePath) === false) {
            $path = $basePath.$path;
        }

        return $path;
    }
88358
public function save($path)
    {
        if (count($this->libs) === 0) {
            return false;
        }

        $handle = fopen($path, 'w');

        if ($handle === false) {
            throw new \InvalidArgumentException('This path is not writabled: ' . $path);
        }

        $first = true;
        $eol = chr(10);

        fwrite($handle, '<?php' . $eol . 'return array(');

        foreach ($this->libs as $key => $value) {
            $value = self::relativePath($value);

            fwrite($handle, ($first ? '' : ',') . $eol . "    '" . $key . "' => '" . $value . "'");

            $first = false;
        }

        fwrite($handle, $eol . ');' . $eol);
        fclose($handle);

        return true;
    }
326481
protected function setPath($path)
    {
        if ($path !== '' && !$this->isValidPath($path)) {
            throw new \InvalidArgumentException("Invalid path '$path'");
        }
        
        $this->path = (string)$path;
    }
643658
protected function checkPath($path)
    {
        // provide compatibility with objects such as \SplFileInfo
        if (is_object($path) && method_exists($path, '__toString')) {
            $path = (string) $path;
        }

        $handle = @fopen($path, 'r');

        if (false === $handle) {
            throw new InvalidArgumentException(sprintf('File %s does not exist.', $path));
        }

        fclose($handle);

        return $path.'[0]';
    }
644826
public function setBasePath($path)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException(
                'Path must be a string'
            );
        }

        // Can not be empty
        if ($path == '') {
            throw new InvalidArgumentException(
                'Path can not be empty'
            );
        }

        $this->basePath = $path;
        return $this;
    }
884779
public function path($path = null)
    {
        if ($path !== null) {
            $this->path = $path;
        }

        return (string) $this->path;
    }
500963
public function withPath($path): UriInterface
   {
       if (!is_string($path)
        || !($parsedPath = $this->parsePath($path))) {
           throw new InvalidArgumentException(
               "Can't get with path: invalid expression");
       }
       return $this->with("path", $parsedPath);
   }