ImportImageDownloadResult
in package
FinalYes
Result of one image download ({@see ImportImageDownloader::download()}): a temporary file on disk (not bytes in memory, images dominate the cost) + the `sha256` of the content and the actually detected extension (`getimagesize`, not the `Content-Type` header).
The caller (writer) must delete tempPath after reading it; the downloader never deletes its
temporary files.
Private constructor + named factories (success/failure) enforce exactly one of two states, never
an inconsistent combination such as success: true with a filled error.
Table of Contents
Properties
- $error : string|null
- $extension : string|null
- $sha256 : string|null
- $size : int|null
- $success : bool
- $tempPath : string|null
Methods
- failure() : self
- success() : self
- __construct() : mixed
Properties
$error read-only
public
string|null
$error
$extension read-only
public
string|null
$extension
$sha256 read-only
public
string|null
$sha256
$size read-only
public
int|null
$size
$success read-only
public
bool
$success
$tempPath read-only
public
string|null
$tempPath
Methods
failure()
public
static failure(string $error) : self
Parameters
- $error : string
Return values
selfsuccess()
public
static success(string $tempPath, string $extension, string $sha256, int $size) : self
Parameters
- $tempPath : string
- $extension : string
- $sha256 : string
- $size : int
Return values
self__construct()
private
__construct(bool $success, string|null $tempPath, string|null $extension, string|null $sha256, int|null $size, string|null $error) : mixed
Parameters
- $success : bool
- $tempPath : string|null
- $extension : string|null
- $sha256 : string|null
- $size : int|null
- $error : string|null