Arrayable
in package
Uses
Microable
Table of Contents
Properties
Methods
- __call() : mixed
- Dynamically handle calls to the class.
- __callStatic() : mixed
- Dynamically handle calls to the class.
- __construct() : mixed
- __get() : mixed
- __isset() : mixed
- __set() : mixed
- __toString() : string
- __unset() : mixed
- add() : Arrayable
- Add a key value pair to the array If only the key is provided, the key will be the value
- addAfter() : static
- addBefore() : static
- all() : array<string|int, mixed>
- arrayType() : string
- Get the type of the array
- at() : mixed
- chunk() : static
- each() : static
- filter() : Arrayable
- Filter the array
- first() : mixed
- flush() : static
- flushMacros() : void
- Remove all the macros we had registered
- get() : mixed
- Get an item from the array
- has() : bool
- Check if the array has a key
- hasMacro() : bool
- Check if we have a method in the balonables
- isAssoc() : bool
- Checks if an array is associative
- isEmpty() : bool
- Checks if the array is empty
- isFilled() : bool
- isMixed() : bool
- Checks if an array has both numeric and string keys
- keys() : array<string|int, mixed>
- Get the keys of the array
- keysToLowerCase() : static
- keysToUpperCase() : static
- last() : mixed
- macro() : void
- Add a new mixable to the macros
- map() : Arrayable
- Map through the array
- merge() : Arrayable
- Merge a whole into the current array
- mixin() : void
- Mix another object into the class.
- pop() : mixed
- reduce() : Arrayable
- Reduce the array
- remove() : Arrayable
- Remove an item from the array
- replace() : static
- reverse() : static
- shift() : mixed
- size() : int
- Get the size of the array
- slice() : static
- sort() : static
- sortKeys() : static
- sortValues() : static
- toArray() : array<string|int, mixed>
- Convert the arrayable to an array
- toArrayable() : Arrayable
- toJson() : string
- Convert the arrayable to json
- unshift() : static
- values() : array<string|int, mixed>
- Get the values of the array
- valuesToLowerCase() : static
Properties
$macros
protected
static array<string|int, mixed>
$macros
= []
$array
private
array<string|int, mixed>
$array
= []
Methods
__call()
Dynamically handle calls to the class.
public
__call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
__callStatic()
Dynamically handle calls to the class.
public
static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
__construct()
public
__construct([array<string|int, mixed> $array = [] ]) : mixed
Parameters
- $array : array<string|int, mixed> = []
__get()
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
__isset()
public
__isset(mixed $name) : mixed
Parameters
- $name : mixed
__set()
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
__toString()
public
__toString() : string
Return values
string__unset()
public
__unset(mixed $name) : mixed
Parameters
- $name : mixed
add()
Add a key value pair to the array If only the key is provided, the key will be the value
public
add(string $key[, mixed|null $value = null ]) : Arrayable
Parameters
- $key : string
- $value : mixed|null = null
Return values
ArrayableaddAfter()
public
addAfter(mixed $positionKey, mixed $key[, mixed $value = null ]) : static
Parameters
- $positionKey : mixed
- $key : mixed
- $value : mixed = null
Return values
staticaddBefore()
public
addBefore(string $positionKey, string $key[, mixed $value = null ]) : static
Parameters
- $positionKey : string
- $key : string
- $value : mixed = null
Return values
staticall()
public
all() : array<string|int, mixed>
Return values
array<string|int, mixed>arrayType()
Get the type of the array
public
arrayType([array<string|int, mixed>|null $arr = null ]) : string
Parameters
- $arr : array<string|int, mixed>|null = null
Return values
stringat()
public
at(int $index) : mixed
Parameters
- $index : int
chunk()
public
chunk(int $size[, bool $preserve_keys = false ]) : static
Parameters
- $size : int
- $preserve_keys : bool = false
Return values
staticeach()
public
each(callable $callback) : static
Parameters
- $callback : callable
Return values
staticfilter()
Filter the array
public
filter(callable $callback) : Arrayable
Parameters
- $callback : callable
Return values
Arrayablefirst()
public
first() : mixed
flush()
public
flush() : static
Return values
staticflushMacros()
Remove all the macros we had registered
public
static flushMacros() : void
get()
Get an item from the array
public
get(string|null $name[, bool|null $checkUpperAndLower = true ]) : mixed
If checkUpperAndLower is set to true, the method will check for uppercase and lowercase cases
Parameters
- $name : string|null
- $checkUpperAndLower : bool|null = true
has()
Check if the array has a key
public
has(string $key) : bool
Parameters
- $key : string
Return values
boolhasMacro()
Check if we have a method in the balonables
public
static hasMacro(string $name) : bool
Parameters
- $name : string
Return values
boolisAssoc()
Checks if an array is associative
public
isAssoc([array<string|int, mixed>|null $arr = null ]) : bool
Parameters
- $arr : array<string|int, mixed>|null = null
Return values
boolisEmpty()
Checks if the array is empty
public
isEmpty() : bool
Return values
boolisFilled()
public
isFilled() : bool
Return values
boolisMixed()
Checks if an array has both numeric and string keys
public
isMixed([array<string|int, mixed>|null $arr = null ]) : bool
Parameters
- $arr : array<string|int, mixed>|null = null
Return values
boolkeys()
Get the keys of the array
public
keys() : array<string|int, mixed>
Return values
array<string|int, mixed>keysToLowerCase()
public
keysToLowerCase() : static
Return values
statickeysToUpperCase()
public
keysToUpperCase() : static
Return values
staticlast()
public
last() : mixed
macro()
Add a new mixable to the macros
public
static macro(string $key, $value) : void
Parameters
map()
Map through the array
public
map(callable $callback) : Arrayable
Parameters
- $callback : callable
Return values
Arrayablemerge()
Merge a whole into the current array
public
merge(array<string|int, mixed> $array) : Arrayable
Parameters
- $array : array<string|int, mixed>
Return values
Arrayablemixin()
Mix another object into the class.
public
static mixin(object $mixin[, bool $replace = true ]) : void
Parameters
- $mixin : object
- $replace : bool = true
Tags
pop()
public
pop() : mixed
reduce()
Reduce the array
public
reduce(callable $callback[, null $initial = null ]) : Arrayable
Parameters
- $callback : callable
- $initial : null = null
Return values
Arrayableremove()
Remove an item from the array
public
remove(string $key) : Arrayable
Parameters
- $key : string
Return values
Arrayablereplace()
public
replace(string $key[, mixed $value = null ]) : static
Parameters
- $key : string
- $value : mixed = null
Return values
staticreverse()
public
reverse() : static
Return values
staticshift()
public
shift() : mixed
size()
Get the size of the array
public
size() : int
Return values
intslice()
public
slice(int $offset[, int $length = null ][, mixed $preserve_keys = false ]) : static
Parameters
- $offset : int
- $length : int = null
- $preserve_keys : mixed = false
Return values
staticsort()
public
sort(callable $callback) : static
Parameters
- $callback : callable
Return values
staticsortKeys()
public
sortKeys(callable $callback) : static
Parameters
- $callback : callable
Return values
staticsortValues()
public
sortValues(callable $callback) : static
Parameters
- $callback : callable
Return values
statictoArray()
Convert the arrayable to an array
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>toArrayable()
public
static toArrayable(array<string|int, mixed> $array) : Arrayable
Parameters
- $array : array<string|int, mixed>
Return values
ArrayabletoJson()
Convert the arrayable to json
public
toJson() : string
Return values
stringunshift()
public
unshift(array<string|int, mixed> $value) : static
Parameters
- $value : array<string|int, mixed>
Return values
staticvalues()
Get the values of the array
public
values() : array<string|int, mixed>
Return values
array<string|int, mixed>valuesToLowerCase()
public
valuesToLowerCase() : static