Arikaim CMS

Utils
in package

Utility static functions

Table of Contents

Methods

call()  : mixed
Call object method
callStatic()  : mixed
Call static method
checkVersion()  : bool
Return true if required version = current or <
cleanJson()  : string
Clean JSON text
constant()  : mixed
Return constant value or default if constant not defined.
convertPathToUrl()  : string
Convert path to url
convertToBytes()  : int|null
Convert to bytes
createKey()  : string
Create key
createRandomKey()  : string
Create random key
createToken()  : string
Create unique token
formatVersion()  : string
Format version to full version format 0.0.0
getBaseClassName()  : string
Return base class name
getClasses()  : array<string|int, mixed>
Return classes from php code
getDefault()  : mixed
Return default if variable is empty
getExecutionTime()  : float
Get script execution time
getMemorySizeText()  : string|array<string|int, mixed>
Get memory size text.
getParentPath()  : string|false
Get parent path
getValueAsText()  : string
Convert value to text
hasHtml()  : bool
Check if text contains thml tags
isClosure()  : bool
Return true if variable is Closure
isEmail()  : bool
Return true if email is valid
isEmpty()  : bool
Check if variable is empty
isImplemented()  : bool
Check if class implement interface
isJson()  : bool
Return true if text is valid JSON
isUtf()  : bool
Return true if text is utf8 encoded string
isValidIp()  : bool
Return true if ip is valid.
isValidUrl()  : bool
Return true if url is valid
jsonDecode()  : array<string|int, mixed>
Decode JSON text
jsonEncode()  : string|null
Encode array to JSON
removeBOM()  : string
Remove BOM from text
slug()  : string
Create slug

Methods

call()

Call object method

public static call(object $obj, string $method[, array<string|int, mixed>|null $args = null ]) : mixed
Parameters
$obj : object
$method : string
$args : array<string|int, mixed>|null = null

callStatic()

Call static method

public static callStatic(string $class, string $method[, array<string|int, mixed>|null $args = null ]) : mixed
Parameters
$class : string
$method : string
$args : array<string|int, mixed>|null = null

checkVersion()

Return true if required version = current or <

public static checkVersion(string $currentVersion, string $requiredVersion[, string|null $operator = null ]) : bool
Parameters
$currentVersion : string
$requiredVersion : string
$operator : string|null = null
Return values
bool

cleanJson()

Clean JSON text

public static cleanJson(string $text) : string
Parameters
$text : string
Return values
string

constant()

Return constant value or default if constant not defined.

public static constant(string $name[, mixed $default = null ]) : mixed
Parameters
$name : string
$default : mixed = null

convertPathToUrl()

Convert path to url

public static convertPathToUrl(string $path) : string
Parameters
$path : string
Return values
string

convertToBytes()

Convert to bytes

public static convertToBytes(string|int $size) : int|null
Parameters
$size : string|int
Return values
int|null

createKey()

Create key

public static createKey(string $text[, string $pathItem = null ][, string $separator = '.' ]) : string
Parameters
$text : string
$pathItem : string = null
$separator : string = '.'
Return values
string

createRandomKey()

Create random key

public static createRandomKey() : string
Return values
string

createToken()

Create unique token

public static createToken([string $prefix = '' ][, bool $long = false ]) : string
Parameters
$prefix : string = ''
$long : bool = false
Return values
string

formatVersion()

Format version to full version format 0.0.0

public static formatVersion(string|null $version) : string
Parameters
$version : string|null
Return values
string

getBaseClassName()

Return base class name

public static getBaseClassName(string|object $class) : string
Parameters
$class : string|object
Return values
string

getClasses()

Return classes from php code

public static getClasses(string $phpCode) : array<string|int, mixed>
Parameters
$phpCode : string
Return values
array<string|int, mixed>

getDefault()

Return default if variable is empty

public getDefault(mixed $variable, mixed $default) : mixed
Parameters
$variable : mixed
$default : mixed

getExecutionTime()

Get script execution time

public static getExecutionTime() : float
Return values
float

getMemorySizeText()

Get memory size text.

public static getMemorySizeText(int $size[, array<string|int, mixed> $labels = null ][, bool $asText = true ]) : string|array<string|int, mixed>
Parameters
$size : int
$labels : array<string|int, mixed> = null
$asText : bool = true
Return values
string|array<string|int, mixed>

getParentPath()

Get parent path

public static getParentPath(string $path) : string|false
Parameters
$path : string
Return values
string|false

getValueAsText()

Convert value to text

public static getValueAsText(mixed $value) : string
Parameters
$value : mixed
Return values
string

hasHtml()

Check if text contains thml tags

public static hasHtml(string $text) : bool
Parameters
$text : string
Return values
bool

isClosure()

Return true if variable is Closure

public static isClosure(mixed $variable) : bool
Parameters
$variable : mixed
Return values
bool

isEmail()

Return true if email is valid

public static isEmail(string $email) : bool
Parameters
$email : string
Return values
bool

isEmpty()

Check if variable is empty

public static isEmpty(mixed $var) : bool
Parameters
$var : mixed
Return values
bool

isImplemented()

Check if class implement interface

public static isImplemented(object $obj, string $interfaceName) : bool
Parameters
$obj : object
$interfaceName : string
Return values
bool

isJson()

Return true if text is valid JSON

public static isJson(string|null $jsonText) : bool
Parameters
$jsonText : string|null
Return values
bool

isUtf()

Return true if text is utf8 encoded string

public static isUtf(mixed $text) : bool
Parameters
$text : mixed
Return values
bool

isValidIp()

Return true if ip is valid.

public static isValidIp(string $ip) : bool
Parameters
$ip : string
Return values
bool

isValidUrl()

Return true if url is valid

public static isValidUrl(string $url) : bool
Parameters
$url : string
Return values
bool

jsonDecode()

Decode JSON text

public static jsonDecode(string|null $text[, bool $clean = true ][, bool|null $associative = true ]) : array<string|int, mixed>
Parameters
$text : string|null
$clean : bool = true
$associative : bool|null = true
Return values
array<string|int, mixed>

jsonEncode()

Encode array to JSON

public static jsonEncode(array<string|int, mixed>|null $data) : string|null
Parameters
$data : array<string|int, mixed>|null
Return values
string|null

removeBOM()

Remove BOM from text

public static removeBOM(string $text) : string
Parameters
$text : string
Return values
string

slug()

Create slug

public static slug(string $text[, string $separator = '-' ]) : string
Parameters
$text : string
$separator : string = '-'
Return values
string

        
On this page

Search results