PHP Class Parkour\Access

Afficher le fichier Open project: benjamminf/craft-embedded-assets Class Usage Examples

Méthodes publiques

Méthode Description
get ( array $data, array | string $path, mixed $default = null ) : mixed Returns the value at the given path.
has ( array $data, array | string $path ) : boolean Tells if there is data at the given path.
set ( array $data, array | string $path, mixed $value ) : mixed Sets data at the given path.
splitPath ( array | string $path ) : array Splits a path into multiple keys.
update ( array $data, array | string $path, callable $cb ) : mixed Updates data at the given path.

Method Details

get() public static méthode

Returns the value at the given path.
See also: splitPath()
public static get ( array $data, array | string $path, mixed $default = null ) : mixed
$data array Data.
$path array | string Path.
$default mixed Default value.
Résultat mixed Value.

has() public static méthode

Tells if there is data at the given path.
See also: splitPath()
public static has ( array $data, array | string $path ) : boolean
$data array Data.
$path array | string Path.
Résultat boolean If there is data.

set() public static méthode

Sets data at the given path.
See also: splitPath()
public static set ( array $data, array | string $path, mixed $value ) : mixed
$data array Data.
$path array | string Path.
$value mixed Value.
Résultat mixed Updated data.

splitPath() public static méthode

Splits a path into multiple keys.
public static splitPath ( array | string $path ) : array
$path array | string Path.
Résultat array Keys.

update() public static méthode

Updates data at the given path.
See also: splitPath()
public static update ( array $data, array | string $path, callable $cb ) : mixed
$data array Data.
$path array | string Path.
$cb callable Callback to update the value.
Résultat mixed Updated data.