Utilities to perform common array operations
package | Default |
---|
forceNonEmptyArray(mixed $value,string $valueName = '',string $errorMessage = 'must be a non empty array'): void
Throws |
|
---|
mixed
A value to check
string
The name of the value to be shown at the beginning of the exception message
string
The rest of the exception message
getDuplicateElements(array $array): array
array
An array containing some elements to test
array
list with all the elements that are duplicated on the provided array
hasDuplicateElements(array $array): boolean
Duplicate values with different data types won't be considered as equal ('1', 1 will return false)
array
An array containing some elements to test
boolean
True if there are duplicate values, false otherwise
isArray(mixed $value): boolean
mixed
A value to check
boolean
true if the given value is an array, false otherwise
isEqualTo(array $array1,array $array2): boolean
array
First array to compare
array
Second array to compare
boolean
true if arrays are exactly the same, false if not
isStringFound()
removeDuplicateElements(array $array): array
array
An array with possible duplicate values
array
The same provided array but without duplicate elements
removeElement(array $array,mixed $element)
returns | array The provided array but without the specified element (if found). Note that originally received array is not modified by this method |
---|---|
array
An array (it will not be modified by this method)
mixed
The element that must be removed from the given array