Snaju Inception Docs

Util
in package

Table of Contents

arrayToObject()  : object
classToArray()  : array<string|int, mixed>
Transforms a class to an array.
cleanArray()  : array<string|int, mixed>
Cleans an array, removing any empty values.
colorFromName()  : false|string|array<string|int, string>
Generates a color hex code given its corresponding color name name.
convertToOSPath()  : string|array<string|int, string>|null
formatCurency()  : string
Propertly formats USD currency and returns the value as a string with or without the symbol.
formatPhoneNumber()  : string
Accepts a string and reformats it to match the phone number format: (---) --- ----.
formatRelativeTime()  : mixed
formatUSD()  : string
Propertly formats USD currency and returns the value as a string with or without the symbol.
fromCamelToSnakeCase()  : string
Converts a given string from camelCase to snake_case.
getFirstKey()  : mixed
getPHPDocData()  : mixed
hex2rgb()  : array<string|int, mixed>
Converts a color hex code to its corresponding rgb value.
isBase64()  : mixed
isEmail()  : false|int
Validates a string and returns true if its decoded value is an email.
isJson()  : bool
Validates a string and returns true if its decoded representation is a JSON object.
isPhoneNumber()  : false|int
Validates a string and returns true if its decoded value is a phone number.
parsePhoneNumber()  : mixed
parsePhpDocs()  : array<string|int, mixed>
requireAndGetClassName()  : mixed
returnFinicialStatment()  : mixed
rgb2hex()  : string
Converts a rgb color value to its corresponding color hex code.
setIfExist()  : mixed|null
stringToNumber()  : mixed
toLocalFS()  : mixed
validate()  : mixed

Methods

arrayToObject()

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

classToArray()

Transforms a class to an array.

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

cleanArray()

Cleans an array, removing any empty values.

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

colorFromName()

Generates a color hex code given its corresponding color name name.

public static colorFromName( $name[, bool $hexSymbol = true ]) : false|string|array<string|int, string>
Parameters
$name :
$hexSymbol : bool = true
Return values
false|string|array<string|int, string>

convertToOSPath()

public static convertToOSPath( $filePath) : string|array<string|int, string>|null
Parameters
$filePath :
Tags
todo
Return values
string|array<string|int, string>|null

formatCurency()

Propertly formats USD currency and returns the value as a string with or without the symbol.

public static formatCurency( $bool[, int $dec = 2 ][, false $addCurencySign = false ][, false $allowNegative = false ]) : string
Parameters
$bool :
$dec : int = 2
$addCurencySign : false = false
$allowNegative : false = false
Tags
deprecated

Changed in favor of better naming conventions and support for other currencies other than USD.

see
Util::formatUSD()
Return values
string

formatPhoneNumber()

Accepts a string and reformats it to match the phone number format: (---) --- ----.

public static formatPhoneNumber( $number[, false $hidden = false ]) : string
Parameters
$number :
$hidden : false = false
Tags
todo

Add this method as a ValidatorRule and depcrecate this method.

Return values
string

formatRelativeTime()

public static formatRelativeTime(mixed $ts) : mixed
Parameters
$ts : mixed
Return values
mixed

formatUSD()

Propertly formats USD currency and returns the value as a string with or without the symbol.

public static formatUSD( $bool[, int $dec = 2 ][, false $addCurencySign = false ][, false $allowNegative = false ]) : string
Parameters
$bool :
$dec : int = 2
$addCurencySign : false = false
$allowNegative : false = false
Tags
todo

Add support for formatting currencies other than USD.

Return values
string

fromCamelToSnakeCase()

Converts a given string from camelCase to snake_case.

public static fromCamelToSnakeCase( $string) : string
Parameters
$string :
Return values
string

getFirstKey()

public static getFirstKey(mixed $array) : mixed
Parameters
$array : mixed
Return values
mixed

getPHPDocData()

public static getPHPDocData(mixed $className) : mixed
Parameters
$className : mixed
Return values
mixed

hex2rgb()

Converts a color hex code to its corresponding rgb value.

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

isBase64()

public static isBase64(mixed $string) : mixed
Parameters
$string : mixed
Return values
mixed

isEmail()

Validates a string and returns true if its decoded value is an email.

public static isEmail( $string) : false|int
Parameters
$string :
Tags
todo

Add this method as a ValidatorRule and deprecate this method.

Return values
false|int

isJson()

Validates a string and returns true if its decoded representation is a JSON object.

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

isPhoneNumber()

Validates a string and returns true if its decoded value is a phone number.

public static isPhoneNumber( $string) : false|int
Parameters
$string :
Tags
todo

Add this method as a ValidatorRule and deprecate this method.

Return values
false|int

parsePhoneNumber()

public static parsePhoneNumber(mixed $number) : mixed
Parameters
$number : mixed
Return values
mixed

parsePhpDocs()

public static parsePhpDocs( $doc) : array<string|int, mixed>
Parameters
$doc :
Tags
todo
Return values
array<string|int, mixed>

requireAndGetClassName()

public static requireAndGetClassName(mixed $filePath) : mixed
Parameters
$filePath : mixed
Return values
mixed

returnFinicialStatment()

public static returnFinicialStatment(mixed $number[, mixed $currencySign = "$" ]) : mixed
Parameters
$number : mixed
$currencySign : mixed = "$"
Return values
mixed

rgb2hex()

Converts a rgb color value to its corresponding color hex code.

public static rgb2hex( $rgb) : string
Parameters
$rgb :
Return values
string

setIfExist()

public static setIfExist( &$obj[, null $default = null ]) : mixed|null
Parameters
$obj :
$default : null = null
Tags
todo
Return values
mixed|null

stringToNumber()

public static stringToNumber(mixed $string) : mixed
Parameters
$string : mixed
Return values
mixed

toLocalFS()

public static toLocalFS(mixed $path) : mixed
Parameters
$path : mixed
Return values
mixed

validate()

public static validate(mixed ...$elm) : mixed
Parameters
$elm : mixed
Return values
mixed

Search results