File
Table of Contents
Methods
- __construct() : mixed
- File constructor.
- addError() : void
- Adds error into errorConnection
- checkFile() : Result
- createCanvas() : array<string|int, mixed>
- deleteCache() : void
- deleteFile() : bool
- fromArray() : void
- Restore data from array and saves into cache.
- getErrorCollection() : ErrorCollection
- Returns error collection.
- getErrorMessage() : string
- Returns error message.
- getFile() : array<string|int, mixed>|null
- Returns file data array.
- getHash() : string
- getId() : string
- getName() : string
- getSize() : int
- getType() : string
- getUploadErrorMessage() : string
- getUrlFromRelativePath() : mixed
- hasError() : bool
- Checks if errorCollection has errors.
- http() : HttpClient
- initHash() : string
- isExecuted() : bool
- Check if file is executed.
- isUploaded() : bool
- Checks if file is uploaded.
- merge() : array<string|int, mixed>
- this function just merge 2 arrays with a lot of deep keys array_merge replaces keys in second level and deeper array_merge_recursive multiplies similar keys
- saveFile() : Result
- Saves file on drive.
- saveLog() : void
- Saves changes into cache.
- setExecuteStatus() : void
- Sets executed status.
- setFile() : void
- Sets file data in file with code $code and saves changes into cache.
- setUploadStatus() : void
- Sets upload status.
- toArray() : array<string|int, mixed>
- Returns file whole data.
- view() : bool|mixed
- viewFile() : void
Methods
__construct()
File constructor.
public
__construct(Package $package, array<string|int, mixed> $file) : mixed
Parameters
- $package : Package
-
Package for file.
- $file : array<string|int, mixed>
-
File array.
addError()
Adds error into errorConnection
public
addError(Error $error) : void
Parameters
- $error : Error
checkFile()
public
static checkFile(mixed &$file, File $f, mixed $params) : Result
Parameters
- $file : mixed
- $f : File
- $params : mixed
Return values
ResultcreateCanvas()
public
static createCanvas(array<string|int, mixed> $source, array<string|int, mixed> $dest[, array<string|int, mixed> $canvasParams = array() ][, array<string|int, mixed> $watermarkParams = array() ]) : array<string|int, mixed>
Parameters
- $source : array<string|int, mixed>
-
Source file.
- $dest : array<string|int, mixed>
-
Destination File.
- $canvasParams : array<string|int, mixed> = array()
-
Array("width" => 100, "height" => 100).
- $watermarkParams : array<string|int, mixed> = array()
-
Array("position" => "top", "type" => "text", "text" => "Bla-bla", "font" => "", "color" => "red").
Return values
array<string|int, mixed>deleteCache()
public
static deleteCache(Package $package, array<string|int, mixed> $file) : void
Parameters
- $package : Package
- $file : array<string|int, mixed>
deleteFile()
public
static deleteFile(string $cid, string $hash, string $path) : bool
Parameters
- $cid : string
-
Control exemplar ID.
- $hash : string
-
File ID.
- $path : string
-
Path to temporary directory.
Return values
boolfromArray()
Restore data from array and saves into cache.
public
fromArray(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
getErrorCollection()
Returns error collection.
public
getErrorCollection() : ErrorCollection
Return values
ErrorCollectiongetErrorMessage()
Returns error message.
public
getErrorMessage() : string
Return values
stringgetFile()
Returns file data array.
public
getFile(string $code) : array<string|int, mixed>|null
Parameters
- $code : string
-
File code like "default", "real_picture".
Return values
array<string|int, mixed>|nullgetHash()
public
getHash() : string
Return values
stringgetId()
public
getId() : string
Return values
stringgetName()
public
getName() : string
Return values
stringgetSize()
public
getSize() : int
Return values
intgetType()
public
getType() : string
Return values
stringgetUploadErrorMessage()
public
static getUploadErrorMessage(mixed $error) : string
Parameters
- $error : mixed
Return values
stringgetUrlFromRelativePath()
public
static getUrlFromRelativePath(mixed $tmpName) : mixed
Parameters
- $tmpName : mixed
hasError()
Checks if errorCollection has errors.
public
hasError() : bool
Return values
boolhttp()
public
static http() : HttpClient
Return values
HttpClientinitHash()
public
static initHash([array<string|int, mixed> $file = array() ]) : string
Parameters
- $file : array<string|int, mixed> = array()
-
File array("id" => ... ).
Return values
stringisExecuted()
Check if file is executed.
public
isExecuted() : bool
Return values
boolisUploaded()
Checks if file is uploaded.
public
isUploaded() : bool
Return values
boolmerge()
this function just merge 2 arrays with a lot of deep keys array_merge replaces keys in second level and deeper array_merge_recursive multiplies similar keys
public
static merge(mixed $res, mixed $res2) : array<string|int, mixed>
Parameters
- $res : mixed
- $res2 : mixed
Return values
array<string|int, mixed>saveFile()
Saves file on drive.
public
saveFile(array<string|int, mixed> &$file, Storable $storage, array<string|int, mixed> $copies) : Result
Parameters
- $file : array<string|int, mixed>
-
Array("name" => "", "code" => ..., "type" => ..., "uploadStatus" => "inprogress",...).
- $storage : Storable
-
.
- $copies : array<string|int, mixed>
-
Array("small" => array("width" => 100, "height" => 100)).
Return values
ResultsaveLog()
Saves changes into cache.
public
saveLog() : void
setExecuteStatus()
Sets executed status.
public
setExecuteStatus(string $status) : void
Parameters
- $status : string
setFile()
Sets file data in file with code $code and saves changes into cache.
public
setFile(string $code, array<string|int, mixed> $data) : void
Parameters
- $code : string
-
File code like "default", "real_picture".
- $data : array<string|int, mixed>
-
Array("name" => "", "code" => ..., "type" => ..., "uploadStatus" => "inprogress",...).
setUploadStatus()
Sets upload status.
public
setUploadStatus(string $status) : void
Parameters
- $status : string
toArray()
Returns file whole data.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>view()
public
static view(array<string|int, mixed> $fileData[, array<string|int, mixed> $options = array() ]) : bool|mixed
Parameters
- $fileData : array<string|int, mixed>
- $options : array<string|int, mixed> = array()
Return values
bool|mixedviewFile()
public
static viewFile(string $cid, string $hash, string $path) : void
Parameters
- $cid : string
-
Control exemplar ID.
- $hash : string
-
File ID.
- $path : string
-
Path to temporary directory.