{@inheritdoc}

@param string $path The path to use with the new instance.
@return self A new instance with the specified path.
@throws \InvalidArgumentException for invalid paths.
167550
public function withPath($path)
    {
        if (!is_string($path) || strpos($path, '#') !== false || strpos($path, '?') !== false) {
            throw new \InvalidArgumentException('Path must be a string and cannot contain a fragment or query string');
        }

        if (!empty($path) && '/' !== substr($path, 0, 1)) {
            $path = '/' . $path;
        }

        return $this->_clone('path', $this->filterPath($path));
    }
1158331
protected function setCacheDir($path)
    {
        if (!is_dir($path)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Cache directory at %s could not be found',
                    $path
                )
            );
        }
        if (!is_readable($path)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Cache directory at %s is not readable',
                    $path
                )
            );
        }
        if (!is_writable($path)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Cache directory at %s is not writable',
                    $path
                )
            );
        }

        $this->cacheDir = realpath($path);
    }
887922
public function setStdinFile(string $path): Process
    {
        if (!is_readable($path)) {
            throw new \InvalidArgumentException(
                "invalid value provided for 'path'; ".
                "'$path' is not a readable file"
            );
        }
        $this->spec[self::STDIN] = ["file", $path, "r"];
        $this->stdin = "";
        return $this;
    }
592385
public function setPath($path)
        {
            if (realpath($path) === false) {
                throw new Exception("Path must be absolute.");
            }

            $this->_path = realpath($path) . DS;
            return $this;
        }
729366
public function withPath(string $path): self
    {
        $newConstraints = $this->constraints;
        $newConstraints[self::CONSTRAINT_PATH] = $path;
        return new static($newConstraints);
    }
283646
public function setPath($path)
    {
        $this->path = '';
        $this->realPath = $path;

        if(!empty($path)) {
            $this->path .= $this->str($path)->trim()->trimLeft('/')->trimRight('/')->val();
        }

        return $this;
    }
884013
public function filePath($path)
    {
        $file = $this->realPath($path);
        if (!is_file($file)) {
            throw new \InvalidArgumentException(sprintf('The path is not a file: %s', $file));
        }

        return $path;
    }
1360937
function addCommandsDirectory(string $path) {
        $path = \realpath($path);
        if($path === false) {
            throw new \InvalidArgumentException('Invalid path specified');
        }
        
        if($path !== $this->basepath && !\in_array($path, $this->commandsDirectories, true)) {
            $this->commandsDirectories[] = $path;
        }
        
        return $this;
    }
859390
public function getAsInstance($path)
    {
        if (empty($path)) {
            return static::create([], $this->separator);
        }
        $value = $this->getAsArray($path);
        if (!is_array($value)) {
            throw new \InvalidArgumentException('You cannot return a Parameter instance on a non-array value.');
        }
        return static::create($this->getAsArray($path), $this->separator);
    }
501780
public function setPath($path)
    {
        if(empty($path)) {
            $this->_path = '/';
        } else {
            $this->_path = $path;
        }

        return $this;
    }
954689
public function setCachePath($path)
    {
        if (@file_exists($path) && is_dir($path)) {
            $this->cache_path = realpath($path).'/';
        } elseif (null!==$path_rp = $this->findRealPath($path)) {
            $this->cache_path = rtrim($path_rp, '/').'/';
        } else {
            throw new \InvalidArgumentException(
                sprintf('Cache path "%s" was not found or is not a directory!', $path)
            );
        }
        return $this;
    }
836675
public function setRelativePath($path)
	{
		if ( ! is_string($path))
		{
			throw new \InvalidArgumentException('Относительный путь к ресурсу должен быть строкового типа.');
		}

		$this->isModified = true;
		$this->parameters['path'] = '/'.ltrim($path, ' /');

		return $this;
	}
111142
public function load($path)
    {
        // Load template
        try {
            $template = $this->twig->loadTemplate($path);
        } catch (LoaderError $e) {
            throw new InvalidArgumentException("Error loading $path: ". $e->getMessage(), $e->getCode(), $e);
        }

        if ($template instanceof Template) {
            // Events are already fired by the View Environment
            $template->setFiredEvents(true);
        }

        return $template;
    }
562261
function requireTree($path)
    {
        $resolved = $this->resolve($path);

        if (!$resolved) {
            throw new \InvalidArgumentException("Path '$path' not found.");
        }

        $dir = new \FilesystemIterator($resolved);

        foreach ($dir as $file) {
            # Ignore dotted files
            if (substr($file->getBasename(), 0, 1) !== '.') {
                $this->requireAsset($file->getRealpath());
            }
        }

        return $this;
    }
849576
protected function setPath($path)
    {
        $this->uriString = null;

        $path = (string) $path;

        if (strpos($path, '?') !== false) {
            throw new InvalidArgumentException(
                'Invalid path provided; must not contain a query string.'
            );
        }

        if (strpos($path, '#') !== false) {
            throw new InvalidArgumentException(
                'Invalid path provided; must not contain a URI fragment.'
            );
        }

        $this->path = static::encode($path);

        return $this;
    }
49365
public static function createFromPath(string $path)
    {
        $createFunctions = [
            'image/png' => 'imagecreatefrompng',
            'image/jpeg' => 'imagecreatefromjpeg',
            'image/gif' => 'imagecreatefromgif',
        ];

        $mimeType = mime_content_type($path);

        if (!array_key_exists($mimeType, $createFunctions)) {
            throw new InvalidMimeTypeException(sprintf('The "%s" mime type is not supported.', $mimeType));
        }

        $resource = $createFunctions[$mimeType]($path);

        return new static($resource);
    }
985166
public function changePath($path)
    {
        $pathname = $this->createPathname($path, $this->getBasename(), $this->getExtension());

        return new static($pathname);
    }