Menu

## Util
in package

Util.php : 7

### 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()

Util.php : 507
`public static arrayToObject(array<string|int, mixed> $array) : object`

##### Parameters

$array : array<string|int, mixed>

##### Return values

object —

#### classToArray()

Util.php : 144

Transforms a class to an array.

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

##### Parameters

$object :

##### Return values

array<string|int, mixed> —

#### cleanArray()

Util.php : 244

Cleans an array, removing any empty values.

`public static cleanArray( $array) : array<string|int, mixed>`

##### Parameters

$array :

##### Return values

array<string|int, mixed> —

#### colorFromName()

Util.php : 68

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()

Util.php : 262
`public static convertToOSPath( $filePath) : string|array<string|int, string>|null`

##### Parameters

$filePath :

##### Tags

todo

##### Return values

string|array<string|int, string>|null —

#### formatCurency()

Util.php : 170

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()

Util.php : 345

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()

Util.php : 387
`public static formatRelativeTime(mixed $ts) : mixed`

##### Parameters

$ts : mixed

##### Return values

mixed —

#### formatUSD()

Util.php : 196

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()

Util.php : 502

Converts a given string from camelCase to snake_case.

`public static fromCamelToSnakeCase( $string) : string`

##### Parameters

$string :

##### Return values

string —

#### getFirstKey()

Util.php : 487
`public static getFirstKey(mixed $array) : mixed`

##### Parameters

$array : mixed

##### Return values

mixed —

#### getPHPDocData()

Util.php : 10
`public static getPHPDocData(mixed $className) : mixed`

##### Parameters

$className : mixed

##### Return values

mixed —

#### hex2rgb()

Util.php : 43

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()

Util.php : 471
`public static isBase64(mixed $string) : mixed`

##### Parameters

$string : mixed

##### Return values

mixed —

#### isEmail()

Util.php : 331

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()

Util.php : 300

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()

Util.php : 318

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()

Util.php : 360
`public static parsePhoneNumber(mixed $number) : mixed`

##### Parameters

$number : mixed

##### Return values

mixed —

#### parsePhpDocs()

Util.php : 217
`public static parsePhpDocs( $doc) : array<string|int, mixed>`

##### Parameters

$doc :

##### Tags

todo

##### Return values

array<string|int, mixed> —

#### requireAndGetClassName()

Util.php : 476
`public static requireAndGetClassName(mixed $filePath) : mixed`

##### Parameters

$filePath : mixed

##### Return values

mixed —

#### returnFinicialStatment()

Util.php : 457
`public static returnFinicialStatment(mixed $number[, mixed $currencySign = "$" ]) : mixed`

##### Parameters

$number : mixed
$currencySign : mixed = "$"

##### Return values

mixed —

#### rgb2hex()

Util.php : 128

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

`public static rgb2hex( $rgb) : string`

##### Parameters

$rgb :

##### Return values

string —

#### setIfExist()

Util.php : 274
`public static setIfExist( &$obj[, null $default = null ]) : mixed|null`

##### Parameters

$obj :
$default : null = null

##### Tags

todo

##### Return values

mixed|null —

#### stringToNumber()

Util.php : 371
`public static stringToNumber(mixed $string) : mixed`

##### Parameters

$string : mixed

##### Return values

mixed —

#### toLocalFS()

Util.php : 32
`public static toLocalFS(mixed $path) : mixed`

##### Parameters

$path : mixed

##### Return values

mixed —

#### validate()

Util.php : 283
`public static validate(mixed ...$elm) : mixed`

##### Parameters

$elm : mixed

##### Return values

mixed —

## Search results