PHP Trait Webiny\Component\StdLib\StdObject\ArrayObject\ValidatorTrait

Afficher le fichier Open project: Webiny/Framework

Méthodes publiques

Méthode Description
inArray ( mixed $value, boolean $strict = false ) : boolean | key Search the array for the given $value.
keyExists ( string | StringObject $key, mixed $default = false ) : boolean | mixed Checks if $key exists in current array as index. If it exists, true is returned.
keyExistsNested ( string | StringObject $key, mixed $default = false ) : boolean | mixed Checks if $key exists in current array as index. If it exists, true is returned.
keysExist ( array $keys = [] ) : boolean Check if all given keys exist in the array

Method Details

inArray() public méthode

If $strict is true, both values must be of the same instance type.
public inArray ( mixed $value, boolean $strict = false ) : boolean | key
$value mixed
$strict boolean
Résultat boolean | key Returns the key under which the $value is found, or false.

keyExists() public méthode

If the $key doesn't exist, $default is returned,
public keyExists ( string | StringObject $key, mixed $default = false ) : boolean | mixed
$key string | Webiny\Component\StdLib\StdObject\StringObject\StringObject Array key.
$default mixed If key is not found, $default is returned.
Résultat boolean | mixed True is returned if the key exists, otherwise $default is returned.

keyExistsNested() public méthode

If the $key doesn't exist, $default is returned. This method supports nested keys access: 'level1.level2.level3'
public keyExistsNested ( string | StringObject $key, mixed $default = false ) : boolean | mixed
$key string | Webiny\Component\StdLib\StdObject\StringObject\StringObject Array key. Eg: 'level1.level2.level3'
$default mixed If key is not found, $default is returned.
Résultat boolean | mixed True is returned if the key exists, otherwise $default is returned.

keysExist() public méthode

Check if all given keys exist in the array
public keysExist ( array $keys = [] ) : boolean
$keys array
Résultat boolean