public static function fromResource(ResourceInterface $resource, $path)
	{
		if ($resource instanceof FileResourceInterface) {
			return $resource;
		}
		file_put_contents($path, $resource->getStream());
		$attr = [
			'mimetype' => $resource->getMimetype(),
			'lastmodified' => $resource->getLastModified(),
			'filename' => $resource->getFilename()
		];
		return new FileResource($path, $attr);
	}
public static function fromResource(ResourceInterface $resource, $path)
	{
		if ($resource instanceof FileResourceInterface) {
			return $resource;
		}
		file_put_contents($path, $resource->getStream());
		$attr = [
			'mimetype' => $resource->getMimetype(),
			'lastmodified' => $resource->getLastModified(),
			'filename' => $resource->getFilename()
		];
		return new FileResource($path, $attr);
	}
public static function fromResource ( ResourceInterface $ resource , $ path ) { if ( $ resource instanceof FileResourceInterface ) { return $ resource ; } file_put_contents ( $ path , $ resource -> getStream ( ) ) ; $ attr = [ 'mimetype' => $ resource -> getMimetype ( ) , 'lastmodified' => $ resource -> getLastModified ( ) , 'filename' => $ resource -> getFilename ( ) ] ; return new FileResource ( $ path , $ attr ) ; }
Converts any resource to a local resource.

@param ResourceInterface $resource
@param string $path
@return FileResource
Converts any resource to a local resource .