ApiOpenStudio PHPDoc

Utilities
in package

Class Utilities

Global utilities.

Table of Contents

$lower_case  : string
String of lower case letters for random().
$number  : string
String of numbers for random().
$special  : string
String of special characters for random().
$upper_case  : string
String of capital letters for random().
dateMysql2php()  : string
Converts mysql date to standard php date.
datePhp2mysql()  : string
Converts php date to standard mysql date.
decryptToken()  : UnencryptedToken
Decrypt and validate the JWT token.
doesUrlExist()  : bool
Check if a URL exists.
getAuthHeaderToken()  : mixed|string|null
Get Authorization header bearer token.
getDbConnection()  : ADOConnection
Return the DB connection, defined in the settings.
getDefinedFunctionsInFile()  : array<string|int, mixed>
List all functions defined in a file.
getLogger()  : MonologWrapper
Return the logger object, defined in the settings.
getMicrotime()  : float
Returns system time in micro secs.
getOpenApiParentClassPath()  : string
Returns the current OpenApiParent* classname
getOpenApiPathClassPath()  : string
Returns the current OpenApiPath* classname
getRolesFromToken()  : array<string|int, mixed>
Get the User roles from the JWT token.
getUidFromToken()  : int
Get the User ID from the JWT token.
getUserIp()  : string
Obtain user IP even if they're under a proxy.
isAssoc()  : bool
Check to see if $m_array is an associative array.
isSecure()  : bool
Check if current URL is https.
makeUrlInsecure()  : void
Redirect to current url under http, if under https.
makeUrlSecure()  : void
Redirect to current url under https, if under http.
mysqlNow()  : string
Create current standard mysql date
randomString()  : string
Creates a random string, of a specified length.
selfUrl()  : array<string|int, mixed>|string
Get the current URL.
setAccessRights()  : void
Recursively set access rights on a directory.
strleft()  : string
Return the character left of a substring win a string.

Properties

$lower_case

String of lower case letters for random().

public static string $lower_case = 'abcdefghijklmnopqrstuvwxyz'

Lower case characters.

$number

String of numbers for random().

public static string $number = '0123456789'

Real numbers.

$special

String of special characters for random().

public static string $special = '!@#$%^&*()'

Special characters.

$upper_case

String of capital letters for random().

public static string $upper_case = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

Upper case characters.

Methods

dateMysql2php()

Converts mysql date to standard php date.

public static dateMysql2php(int $mysqldate) : string
Parameters
$mysqldate : int

Unix time stamp.

Return values
string

datePhp2mysql()

Converts php date to standard mysql date.

public static datePhp2mysql(int $phpdate) : string
Parameters
$phpdate : int

Unix time stamp.

Return values
string

decryptToken()

Decrypt and validate the JWT token.

public static decryptToken([string|null $rawToken = null ]) : UnencryptedToken
Parameters
$rawToken : string|null = null
Tags
throws
ApiException
Return values
UnencryptedToken

doesUrlExist()

Check if a URL exists.

public static doesUrlExist(string $url) : bool
Parameters
$url : string

The URL.

Return values
bool

getAuthHeaderToken()

Get Authorization header bearer token.

public static getAuthHeaderToken() : mixed|string|null
Return values
mixed|string|null

getDbConnection()

Return the DB connection, defined in the settings.

public static getDbConnection(array<string|int, mixed> $dbConfig) : ADOConnection
Parameters
$dbConfig : array<string|int, mixed>

DB section of the config array.

Tags
throws
ApiException
Return values
ADOConnection

getLogger()

Return the logger object, defined in the settings.

public static getLogger(array<string|int, mixed> $debugConfig) : MonologWrapper
Parameters
$debugConfig : array<string|int, mixed>

Debug section of the config array.

Tags
throws
ApiException
Return values
MonologWrapper

getMicrotime()

Returns system time in micro secs.

public static getMicrotime() : float
Return values
float

getOpenApiParentClassPath()

Returns the current OpenApiParent* classname

public static getOpenApiParentClassPath(Config $settings) : string
Parameters
$settings : Config
Tags
throws
ApiException
Return values
string

getOpenApiPathClassPath()

Returns the current OpenApiPath* classname

public static getOpenApiPathClassPath(Config $settings) : string
Parameters
$settings : Config
Tags
throws
ApiException
Return values
string

getRolesFromToken()

Get the User roles from the JWT token.

public static getRolesFromToken([UnencryptedToken|null $decryptedToken = null ]) : array<string|int, mixed>
Parameters
$decryptedToken : UnencryptedToken|null = null

Decrypted JWT token.

Tags
throws
ApiException
Return values
array<string|int, mixed>

getUidFromToken()

Get the User ID from the JWT token.

public static getUidFromToken([UnencryptedToken|null $decryptedToken = null ]) : int
Parameters
$decryptedToken : UnencryptedToken|null = null

Decrypted JWT token.

Tags
throws
ApiException
Return values
int

getUserIp()

Obtain user IP even if they're under a proxy.

public static getUserIp() : string
Return values
string

ip address IP address of the user

isAssoc()

Check to see if $m_array is an associative array.

public static isAssoc(mixed $m_array) : bool
Parameters
$m_array : mixed

Mixed array.

Return values
bool

isSecure()

Check if current URL is https.

public static isSecure() : bool
Return values
bool

makeUrlInsecure()

Redirect to current url under http, if under https.

public static makeUrlInsecure() : void
Return values
void

makeUrlSecure()

Redirect to current url under https, if under http.

public static makeUrlSecure() : void
Return values
void

mysqlNow()

Create current standard mysql date

public static mysqlNow() : string
Return values
string

randomString()

Creates a random string, of a specified length.

public static randomString([int|null $length = null ][, bool|null $lower = null ][, bool|null $upper = null ][, bool|null $number = null ][, bool|null $special = null ]) : string

Contents of string specified by $lower, $upper, $number and $non_alphanum.

Parameters
$length : int|null = null

Length of the string.

$lower : bool|null = null

Include lower case alpha.

$upper : bool|null = null

Include upper case alpha.

$number : bool|null = null

Include integers.

$special : bool|null = null

Include special characters.

Return values
string

selfUrl()

Get the current URL.

public static selfUrl([bool $returnArray = null ]) : array<string|int, mixed>|string
Parameters
$returnArray : bool = null

Return in array format.

Return values
array<string|int, mixed>|string

setAccessRights()

Recursively set access rights on a directory.

public static setAccessRights(string $dir[, int|null $dirAccess = null ][, int|null $fileAccess = null ][, array<string|int, mixed> $nomask = array('.', '..') ]) : void
Parameters
$dir : string

Directory string.

$dirAccess : int|null = null

Directory permission to set.

$fileAccess : int|null = null

File permission to set.

$nomask : array<string|int, mixed> = array('.', '..')

Nomask permission to set.

Return values
void

strleft()

Return the character left of a substring win a string.

public static strleft(string $s1, string $s2) : string
Parameters
$s1 : string

String.

$s2 : string

Substring.

Return values
string

substring left of $s2

Search results