ArrayFilter
in package
Class ArrayFilter.
Table of Contents
- $subjects : array<string|int, mixed>
- __construct() : mixed
- StringFilter constructor.
- empty() : array<string|int, mixed>
- If an array is null or empty, return a null; otherwise return the array.
- first() : array<string|int, mixed>
- Throw an error if all the provided values are null. Otherwise, return the first non-null value.
- object() : array<string|int, mixed>
- Return the subject as a null if empty, or cast to an object otherwise.
- permissions() : array<string|int, object>
- Convert an array into a permissions object.
- trim() : array<string|int, mixed>
- Trim all null values from an array.
Properties
$subjects
private
array<string|int, mixed>
$subjects
Methods
__construct()
StringFilter constructor.
public
__construct(array<string|int, array<string|int, mixed>> $subjects) : mixed
Parameters
- $subjects : array<string|int, array<string|int, mixed>>
-
an array of arrays to filter
Return values
mixed —empty()
If an array is null or empty, return a null; otherwise return the array.
public
empty() : array<string|int, mixed>
Return values
array<string|int, mixed> —first()
Throw an error if all the provided values are null. Otherwise, return the first non-null value.
public
first(Throwable $exception) : array<string|int, mixed>
Parameters
- $exception : Throwable
-
an exception to throw if all values are null
Tags
Return values
array<string|int, mixed> —object()
Return the subject as a null if empty, or cast to an object otherwise.
public
object() : array<string|int, mixed>
Return values
array<string|int, mixed> —permissions()
Convert an array into a permissions object.
public
permissions() : array<string|int, object>
Return values
array<string|int, object> —trim()
Trim all null values from an array.
public
trim() : array<string|int, mixed>