Get a new instance, and ensure the file is readable.

@param $path

@throws NonExistentFileException
@throws FilePermissionsException

@return static
975399
public static function at($path)
    {
        $file = new static($path);

        if (! $file->exists()) {
            throw new NonExistentFileException("File does not exist at $path");
        }

        if (! $file->isReadable()) {
            throw new FilePermissionsException("File not readable at $path");
        }

        return $file;
    }
849927
protected function getRawVisibility($path)
    {
        $file = $this->getFileObject($path);
        $permissions = $file->getPermissions();
        $visibility = AdapterInterface::VISIBILITY_PRIVATE;
        foreach ($permissions as $permission) {
            if ($permission->type === $this->publishPermission['type'] && $permission->role === $this->publishPermission['role']) {
                $visibility = AdapterInterface::VISIBILITY_PUBLIC;
                break;
            }
        }
        return $visibility;
    }
179892
public function get($path)
    {
        $localPath = $this->createUri($path);
        if (!file_exists($localPath)) {
            return null;
        } elseif (!is_readable($localPath)) {
            throw new Exception\OperationFailureException('File reading error.');
        } else {
            return new FileDescriptor($localPath, filesize($localPath));
        }
    }
1365572
public function read($path)
    {
        $path = $this->getPath($path);
        if (!is_readable($path) || !is_file($path)) {
            throw new RuntimeException($path . ' is not readable file');
        }

        return file_get_contents($path);
    }
121778
public static function create( $path ) 
	{	
		if ( is_null( $path ) ) 
		{
			return new static();
		}
		
		// use the orbit path if we are relative
		if ( substr( $path, 0, 1 ) != '/' ) 
		{
			$path = ORBITPATH.$path;
		}
		
		// check the path
		if ( substr( $path, -1 ) != '/' ) 
		{
			$path .= '/';
		}
		
		$blueprint = $path.'blueprint.json';
		
		if ( !file_exists( $blueprint ) ) 
		{
			throw new CCException( "CCOrbit_Ship::create - clould not find a blueprint at {$blueprint}." );
		}
		
		if ( !$blueprint_data = CCJson::read( $blueprint ) )
		{
			throw new CCException( "CCOrbit_Ship::create - invalid blueprint at {$blueprint}." );
		}
		
		return static::blueprint( $blueprint_data, $path );
	}
551899
public function filesystem(string $path = null)
    {
        if (!$this->filesystem instanceof Filesystem) {
            $local = new Local($path);

            $this->filesystem = new Filesystem($local);
        }

        return $this->filesystem;
    }
878869
static function GetFileSystemEntryType($path)
    {
        if (is_file($path))
            return FileSystemEntryType::File();
        else if (is_link($path))
            return FileSystemEntryType::Link();
        else if (is_dir($path))
            return FileSystemEntryType::Folder();
        else
            throw new Exceptions\PathNotFoundException("Path $path not found");
    }
427055
public function mkdir($path)
    {
        $info = $this->info($path);
        if ($info->isDir()) {
            return $this;
        }

        if (!mkdir($info->getStreamUrl(), $this->dirMode, true)) {
            throw new RuntimeException(sprintf(
                'Failed to create directory "%s": %s',
                $path, $this->getLastPhpError()
            ));
        }

        return $this;
    }
327041
public function getObject($path)
    {
        if ($path === '' || $path === '.') {
            return $this;
        }
        $data = $this->getObjectData($path);
        if ($data === false) {
            return false;
        }

        if ($data['type'] === 'blob') {
            return Blob::fromSha($data['sha'], $this->getUri(), $this->client);
        } elseif ($data['type'] === 'tree') {
            return Tree::fromSha($data['sha'], $this->getUri(), $this->client);
        }

        throw new \RuntimeException('Unrecognised object type: ' . $data['type']);
    }
246195
protected function getFile() {
		if ($this->file === null) {
			$path = $this->getFilePath();

			if (! is_file($path)) {
				throw new NoPath('Unable to locate the file: ' . $path);
			}

			$file = fopen($path, 'r');

			if ($file === false) {
				throw new NoPath('Unable to open the file: ' . $path);
			}
		}
		
		return $file;
	}
55281
private function createFromEncrypted(string $path): self
    {
        /** @var resource $imageData */
        $imageData = file_get_contents($path);
        $this->workingData = $imageData;
        $this->encrypted = true;
        return $this;
    }
277300
public static function get_instance( $path ) {
		$path = \wp_normalize_path( $path );
		if ( ! isset( self::$instances[ $path ] ) ) {
			self::$instances[ $path ] = new self( $path );
		}
		return self::$instances[ $path ];
	}
985166
public function changePath($path)
    {
        $pathname = $this->createPathname($path, $this->getBasename(), $this->getExtension());

        return new static($pathname);
    }
757340
public static function get($filePath)
    {
        $fileName = basename($filePath);
        if (!array_key_exists($fileName, static::$files)) {
            try {
                $file = new File($filePath);
            } catch (\Exception $e) {
                $file = false;
            }

            static::$files[$fileName] = $file;
        }

        return static::$files[$fileName];
    }
371287
public function loadFrom($path)
    {
        // Avoid repeat load of broken images
        $hash = sha1($path);
        if ($this->hasFailed($hash, null)) {
            return $this;
        }

        // Handle resource
        $error = self::FAILED_UNKNOWN;
        try {
            $this->setImageResource($this->getImageManager()->make($path));
            $this->markSuccess($hash, null);
            $error = null;
        } catch (NotReadableException $ex) {
            // Handle unsupported image encoding on load (will be marked as failed)
            // Unsupported exceptions are handled without being raised as exceptions
            $error = self::FAILED_INVALID;
        } finally {
            if ($error) {
                $this->markFailed($hash, null, $error);
            }
        }

        return $this;
    }
1287888
public static function fromFile($path) {

        if(!is_file($path) || !is_readable($path)) {

            throw new TempFileException(sprintf('File %s does not exist or is not readable.', $path));
        }

        $tempFile = new static();
        $tempFile->closeFileHandle();

        if(!copy($path, $tempFile->filePath)) {

            throw new TempFileException(sprintf('Could not read in file %s.', $path));
        }

        $tempFile->openFileHandle('r+');

        return $tempFile;
    }
1191293
public function fromPath($path)
    {
        $mimetype = null;

        if (static::isSupported())
        {
            if (!is_file($path)) {
                throw new \RuntimeException('File not found at '.$path);
            }

            if (!is_readable($path)) {
                throw new \RuntimeException('File not readable at '.$path);
            }

            if ($finfo = new \finfo(FILEINFO_MIME_TYPE, $this->getConfig()->magic_file)) {
                $mimetype = $finfo->file($path);
            }
        }

        return $mimetype;
    }