CoolCMS API

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

Methods

success()

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
On this page

Search results