class File

File

Methods

static array|false
readJsonFile(string $fileName, array|null $vars = null)

Load json file and return decoded array

static array|false
getClassesInFile(string $fileName)

Get php classes defined in file

static bool
exists(string $fileName)

Check if file exists

static bool
isWritable(string $fileName)

Return true if file is writtable

static bool
setWritable(string $fileName)

Set file writtable

static integer|false
getSize(string $fileName)

Return file size

static string|array
getSizeText(integer $size, array $labels = null, boolean $asText = true)

Get file size text.

static bool
makeDir(string $path, integer $mode = 0755, bool $recursive = true)

Create directory

static boolean
writeUplaodedFile(array $file, string $path, integer $mode = null, integer $flags = 0)

Undocumented function

static bool
writeEncoded(string $fileName, mixed $encodedData, integer $flags = 0)

Write encoded file

static bool
write(string $fileName, mixed $data, integer $flags = 0)

Write file

static string|null
baseName(string|null $path, string $suffix = '')

Get file base name from path

static string
getExtension(string $fileName)

Return file extension

static bool
delete(string $fileName)

Delete file or durectiry

static bool
isEmpty(string $path)

Return true if direcotry is empty

static bool
deleteDirectory(string $path, bool $skipMainFolder = true)

Delete directory and all sub directories

static mixed|null
read(string $fileName)

Read file

static boolean
isImageMimeType(string $mimeType)

Return true if MIME type is image

static string|false
getMimetype(string $fileName)

Get file mime type

static bool
copy(string $from, string $to, bool $overwrite = true)

Copy file, symlink or directory

static array
scanDir(string $path, array $skip = ['..', '.'])

Get directory files

Details

at line 27
static array|false readJsonFile(string $fileName, array|null $vars = null)

Load json file and return decoded array

Parameters

string $fileName
array|null $vars

Return Value

array|false

at line 50
static array|false getClassesInFile(string $fileName)

Get php classes defined in file

Parameters

string $fileName

Return Value

array|false

at line 66
static bool exists(string $fileName)

Check if file exists

Parameters

string $fileName

Return Value

bool

at line 77
static bool isWritable(string $fileName)

Return true if file is writtable

Parameters

string $fileName

Return Value

bool

at line 88
static bool setWritable(string $fileName)

Set file writtable

Parameters

string $fileName

Return Value

bool

at line 103
static integer|false getSize(string $fileName)

Return file size

Parameters

string $fileName

Return Value

integer|false

at line 116
static string|array getSizeText(integer $size, array $labels = null, boolean $asText = true)

Get file size text.

Parameters

integer $size
array $labels
boolean $asText

Return Value

string|array

at line 129
static bool makeDir(string $path, integer $mode = 0755, bool $recursive = true)

Create directory

Parameters

string $path
integer $mode
bool $recursive

Return Value

bool

at line 143
static boolean writeUplaodedFile(array $file, string $path, integer $mode = null, integer $flags = 0)

Undocumented function

Parameters

array $file
string $path
integer $mode
integer $flags

Return Value

boolean

at line 163
static bool writeEncoded(string $fileName, mixed $encodedData, integer $flags = 0)

Write encoded file

Parameters

string $fileName
mixed $encodedData
integer $flags

Return Value

bool

at line 178
static bool write(string $fileName, mixed $data, integer $flags = 0)

Write file

Parameters

string $fileName
mixed $data
integer $flags

Return Value

bool

at line 192
static string|null baseName(string|null $path, string $suffix = '')

Get file base name from path

Parameters

string|null $path
string $suffix

Return Value

string|null

at line 207
static string getExtension(string $fileName)

Return file extension

Parameters

string $fileName

Return Value

string

at line 218
static bool delete(string $fileName)

Delete file or durectiry

Parameters

string $fileName

Return Value

bool

at line 233
static bool isEmpty(string $path)

Return true if direcotry is empty

Parameters

string $path

Return Value

bool

at line 245
static bool deleteDirectory(string $path, bool $skipMainFolder = true)

Delete directory and all sub directories

Parameters

string $path
bool $skipMainFolder

Return Value

bool

at line 286
static mixed|null read(string $fileName)

Read file

Parameters

string $fileName

Return Value

mixed|null

at line 297
static boolean isImageMimeType(string $mimeType)

Return true if MIME type is image

Parameters

string $mimeType

Return Value

boolean

at line 308
static string|false getMimetype(string $fileName)

Get file mime type

Parameters

string $fileName

Return Value

string|false

at line 321
static bool copy(string $from, string $to, bool $overwrite = true)

Copy file, symlink or directory

Parameters

string $from
string $to
bool $overwrite

Return Value

bool

at line 361
static array scanDir(string $path, array $skip = ['..', '.'])

Get directory files

Parameters

string $path
array $skip

Return Value

array