Set file path.

@param string $filePath

@return $this
@throws \InvalidArgumentException
@throws \Arhitector\Transcoder\Exception\TranscoderException
178954
protected function setFilePath($filePath)
	{
		if ( ! is_string($filePath))
		{
			throw new \InvalidArgumentException('File path must be a string type.');
		}
		
		if (preg_match('~^(\w+:)?//~', $filePath) || is_link($filePath))
		{
			throw new \InvalidArgumentException('File path must be a local path.');
		}
		
		$filePath = realpath($filePath);
		
		if ( ! is_file($filePath))
		{
			throw new TranscoderException('File path not found.');
		}
		
		$this->filePath = $filePath;
		
		return $this;
	}
1241289
public function setWebRootPath($path)
    {
        if (@file_exists($path) && is_dir($path)) {
            $this->web_root_path = realpath($path).'/';
        } else {
            throw new \InvalidArgumentException(
                sprintf('Web root path "%s" was not found or is not a directory!', $path)
            );
        }
        return $this;
    }
350896
public function watermark(string $filePath)
    {
        if (! file_exists($filePath)) {
            throw new FileNotFoundException($filePath);
        }

        $this->addManipulation('watermark', $filePath);

        return $this;
    }
1016297
public function setPath(string $path): RouteInterface
   {
       if (!preg_match("/^([\w-\.\/{}=&\?\[\]])+$/", $path)) {
           throw new InvalidArgumentException(
               "Can't set path: invalid UriInterface path " . $path);
       }

       $this->path = ltrim($path, "/");
       return $this; 
    }
262295
public function withPath($path)
    {
        if (!is_string($path)) {
            throw new \InvalidArgumentException('Invalid path provided; must be a string');
        }
        $path = $this->filterPath($path);

        $new = clone $this;
        $new->path = $path;

        return $new;
    }
659436
public function setPath($path)
	{
		if ( ! is_scalar($path))
		{
			throw new \InvalidArgumentException('Параметр "path" должен быть строкового типа.');
		}

		$this->path = (string) $path;

		return $this;
	}
323325
public function setDocumentRoot($path)
    {
        if (file_exists($path)) {
            $this->document_root = realpath($path);
        } elseif (file_exists(DirectoryHelper::slashDirname($this->getRootDirectory()) . $path)) {
            $this->document_root = DirectoryHelper::slashDirname($this->getRootDirectory()) . $path;
        } else {
            throw new \InvalidArgumentException(
                sprintf('Document root path "%s" doesn\'t exist!', $path)
            );
        }
        return $this;
    }
6677
public function setFilePath($filePath)
    {
        $splFileInfo = new \SplFileInfo($filePath);
        if (!$realFilePath = $splFileInfo->getRealPath()) {
            throw new InvalidArgumentException(
                sprintf('Cannot set file path. File "%s" does not exist.', $filePath)
            );
        }

        if (strpos($realFilePath, $this->sourcePath) !== 0) {
            throw new InvalidArgumentException(
                sprintf('Cannot set file path. File path "%s" does not match source path.', $filePath)
            );
        }

        if (is_null($this->splFileInfo) || $this->splFileInfo->getRealPath() != $realFilePath) {

            $this->splFileInfo = $splFileInfo;

            $relativePath = str_replace($this->sourcePath, '', $realFilePath);
            $this->fileURI = $this->sourceURI . $relativePath;

            $this->property->update();
        }

        return $this;
    }
1179098
public function path(string $path) : PathList
    {
        if (!file_exists($path)) {
            throw new \InvalidArgumentException(
                'Arg path doesn\'t exist, path[' . $path . '].'
            );
        }
        if (!is_dir($path)) {
            throw new \InvalidArgumentException(
                'Arg path is not a directory, path[' . $path . '].'
            );
        }
        $this->path = $path;
        return $this;
    }
150883
public function setPath(string $path): VolumeWriter {

		// remove trailing '/' if found
		if( substr($path, -1) === '/' )
			$path = substr($path, 0, -1);

		$this->path = $path;
		return $this;
	}
389145
public function store_destfile_from_path($filepath) {
        if ($record = $this->get_file_record()) {
            $fs = get_file_storage();
            $existing = $fs->get_file(
                $record['contextid'],
                $record['component'],
                $record['filearea'],
                $record['itemid'],
                $record['filepath'],
                $record['filename']
            );
            if ($existing) {
                $existing->delete();
            }
            $file = $fs->create_file_from_pathname($record, $filepath);

            $this->raw_set('destfileid', $file->get_id());
        }

        return $this;
    }
1115557
public static function createFromFilePath ($filePath)
    {
        if (!is_file($filePath))
        {
            throw new \InvalidArgumentException("File does not exist");
        }
        else if (!is_readable($filePath))
        {
            throw new \InvalidArgumentException("File to download is not readable.");
        }

        return new FileDownload(fopen($filePath, "rb"));
    }
1139384
public function setFontPath($fontPath)
    {
        if (is_file($fontPath)) {
            $this->fontTruetype = true;
            $this->fontPath = $fontPath;
        }

        return $this;
    }
144394
private function setPath($path)
    {
        $this->path =  preg_replace_callback(
            '/(?:[^' . self::$charList . ':@\/%]+|%(?![A-Fa-f0-9]{2}))/',
            [$this, 'encode'],
            $path
        );

        return $this;
    }
886575
public function locate($filePath)
    {
        $file = $filePath;
        if (!is_file($filePath))
        {
            throw new FileException(sprintf('Invalid file! File "%s" does not exist.',
                                            $filePath));
        }

        if (!is_readable($filePath))
        {
            throw new FileException(sprintf('Invalid file! File "%s" is not readable.',
                                            $filePath));
        }

        $pathInfo = pathinfo($filePath);
        if (!isset($pathInfo['extension'])
            || !in_array($pathInfo['extension'], $this->supportedExtensions)
        )
        {
            throw new FileException(sprintf('Invalid file extension! Supported file extensions: %s',
                implode(', ', $this->supportedExtensions)));
        }

        return realpath($file);
    }
219607
private function getRealFilePath( string $filePath ) : string
	{
		$realFilePath = getcwd() . DIRECTORY_SEPARATOR . ltrim( $filePath, '/' );
		$outputDir    = dirname( $realFilePath );
		if ( !@mkdir( $outputDir, 0777, true ) && !is_dir( $outputDir ) )
		{
			throw new InvalidArgumentException( 'Invalid file path: ' . $realFilePath );
		}

		return $realFilePath;
	}
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;
    }