public function path($value = false, $overwrite = false)
    {
        if ($value === false) {
            return $this->path;
        }

        $oldPath = $this->path;

        if (!$overwrite && $this->adapter->fileExists($value)) {
            throw new FilesystemException("Cannot rename the file '{$this->path}' to '{$value}' because a file already exists");
        }

        (new static($value, $this->adapter))->remove();

        if (! $this->adapter->rename($this->path, $value)) {
            throw new FilesystemException("Cannot rename the file '{$this->path}' to '{$value}'");
        }

        $this->path = $value;
        $this->fs = null;
        $this->pathChanged($oldPath);

        return $this;
    }
public function path($value = false, $overwrite = false)
    {
        if ($value === false) {
            return $this->path;
        }

        $oldPath = $this->path;

        if (!$overwrite && $this->adapter->fileExists($value)) {
            throw new FilesystemException("Cannot rename the file '{$this->path}' to '{$value}' because a file already exists");
        }

        (new static($value, $this->adapter))->remove();

        if (! $this->adapter->rename($this->path, $value)) {
            throw new FilesystemException("Cannot rename the file '{$this->path}' to '{$value}'");
        }

        $this->path = $value;
        $this->fs = null;
        $this->pathChanged($oldPath);

        return $this;
    }
public function path ( $ value = false , $ overwrite = false ) { if ( $ value === false ) { return $ this -> path ; } $ oldPath = $ this -> path ; if ( ! $ overwrite && $ this -> adapter -> fileExists ( $ value ) ) { throw new FilesystemException ( "Cannot rename the file '{$this->path}' to '{$value}' because a file already exists" ) ; } ( new static ( $ value , $ this -> adapter ) ) -> remove ( ) ; if ( ! $ this -> adapter -> rename ( $ this -> path , $ value ) ) { throw new FilesystemException ( "Cannot rename the file '{$this->path}' to '{$value}'" ) ; } $ this -> path = $ value ; $ this -> fs = null ; $ this -> pathChanged ( $ oldPath ) ; return $ this ; }
Gets or Sets the path.

@param  string $value
@param  boolean $overwrite
@return string|Tarsana\Filesystem\AbstractFile

@throws Tarsana\Filesystem\Exceptions\FilesystemException if could not rename the file.
Gets or Sets the path .