• Full name: \App\Shared\Services\Utils

Methods

parseStr

Parses a string into variables to be stored in an array.

public static parseStr(string $string, array $array, bool $strict = false): array
  • This method is static. Parameters:
Parameter Type Description
$string string The string to be parsed.
$array array Variables will be stored in this array.
$strict bool If true, skip malformed entries.

Throws:


ifNull

Checks if a variable is null. If not null, check if integer or string.

public static ifNull(int|string $var): string|int|null
  • This method is static. Parameters:
Parameter Type Description
$var int|string Variable to check.

Return Value:

Returns null if empty otherwise a string or an integer.


parseArgs

Merge user defined arguments into defaults array.

public static parseArgs(array|string|object $args, array|string $defaults = '', bool $deep = false): array
  • This method is static. Parameters:
Parameter Type Description
$args array|string|object Value to merge with $defaults.
$defaults array|string Optional. Array that serves as the defaults. Default empty.
$deep bool Whether to deep merge nested arrays.

Return Value:

Merged user defined values with defaults.


getPathInfo

public static getPathInfo(string $relative): mixed
  • This method is static. Parameters:
Parameter Type Description
$relative string

isAdmin

Whether the current request is for an administrative interface.

public static isAdmin(): bool

e.g. /admin/

  • This method is static. Return Value:

True if an admin screen, otherwise false.


isLogin

Whether the current request is for a login interface.

public static isLogin(): bool

e.g. /login/

  • This method is static. Return Value:

True if login screen, otherwise false.