ConfigItemsList
extends ArrayList
in package
Represents a node in a configuration file.
This class extends the ArrayList class and provides functionality to represent a node in a configuration file.
Table of Contents
Constants
- JsonSchema = ['type' => 'array', 'items' => ['type' => 'object', 'patternProperties' => ['.*' => ['type' => ['number', 'string', 'boolean', 'object', 'array', 'null']]]]]
- JSON schema
Properties
Methods
- __construct() : mixed
- Constructor
- Add() : mixed
- Adds item to array list
- Append() : void
- Appends an items to array list
- Clear() : void
- Clears an array list
- Contains() : bool
- Check when item contains in internal array
- Count() : int
- Returns internal array count
- Delete() : bool
- Deletes an item
- DeleteAt() : array<string|int, mixed>
- Deletes an item by index
- Filter() : ArrayList
- Filters an array list by closure
- Find() : mixed
- Finds an item by closure
- First() : mixed
- Returns first item of array list
- getIterator() : ArrayListIterator
- Gets an interator
- IndexOf() : int
- Returns index by item
- InsertAt() : void
- Inserts an item to specified index
- Item() : Config
- Get Item by Index
- jsonSerialize() : array<string|int, mixed>
- Return internal array for json conversion
- Last() : mixed
- Returns last item of array list
- Map() : ArrayList
- Executes an closure for every item and returns new array list
- offsetExists() : bool
- Checks if offset exists in array list (used for ArrayAccess)
- offsetGet() : mixed
- Returns an item at offset position
- offsetSet() : void
- Sets an item by index (used for ArrayAccess)
- offsetUnset() : void
- Deletes an item from array list by index (used for ArrayAccess)
- Set() : mixed
- Sets an item to specified place in array list
- Sort() : void
- Sorts an array list by using internal object field by key
- SortByClosure() : self
- Sorts an array using sort function
- ToArray() : array<string|int, mixed>
- Returns internal array
- ToString() : string
- Returns string representation of array list
Constants
JsonSchema
JSON schema
public
mixed
JsonSchema
= ['type' => 'array', 'items' => ['type' => 'object', 'patternProperties' => ['.*' => ['type' => ['number', 'string', 'boolean', 'object', 'array', 'null']]]]]
Properties
$data
Data
protected
mixed
$data
= null
$_file
private
string
$_file
= ''
Methods
__construct()
Constructor
public
__construct([array<string|int, mixed> $data = array() ][, string $file = '' ]) : mixed
Initializes a new instance of the ConfigItemsList class.
Parameters
- $data : array<string|int, mixed> = array()
-
The data for the configuration items list.
- $file : string = ''
-
The file associated with the configuration items list.
Add()
Adds item to array list
public
Add(mixed $value) : mixed
Parameters
- $value : mixed
-
The item to add.
Tags
Return values
mixed —The updated collection after adding the item.
Append()
Appends an items to array list
public
Append(mixed $values) : void
Parameters
- $values : mixed
Tags
Clear()
Clears an array list
public
Clear() : void
Tags
Contains()
Check when item contains in internal array
public
Contains(mixed $item) : bool
Parameters
- $item : mixed
Tags
Return values
boolCount()
Returns internal array count
public
Count() : int
Tags
Return values
intDelete()
Deletes an item
public
Delete(mixed $value) : bool
Parameters
- $value : mixed
-
The item to delete.
Tags
Return values
bool —True if the item was successfully deleted, false otherwise.
DeleteAt()
Deletes an item by index
public
DeleteAt(int $index) : array<string|int, mixed>
Parameters
- $index : int
-
The index of the item to delete.
Tags
Return values
array<string|int, mixed> —The updated collection after removing the item.
Filter()
Filters an array list by closure
public
Filter(Closure $closure) : ArrayList
Parameters
- $closure : Closure
Tags
Return values
ArrayListFind()
Finds an item by closure
public
Find(Closure $closure) : mixed
Parameters
- $closure : Closure
Tags
First()
Returns first item of array list
public
First() : mixed
Tags
getIterator()
Gets an interator
public
getIterator() : ArrayListIterator
Tags
Return values
ArrayListIteratorIndexOf()
Returns index by item
public
IndexOf(mixed $item) : int
Parameters
- $item : mixed
Tags
Return values
intInsertAt()
Inserts an item to specified index
public
InsertAt(mixed $value, int $toIndex) : void
Parameters
- $value : mixed
- $toIndex : int
Tags
Item()
Get Item by Index
public
Item(int $index) : Config
Retrieves the configuration item at the specified index.
Parameters
- $index : int
-
The index of the configuration item to retrieve.
Return values
Config —The configuration item at the specified index.
jsonSerialize()
Return internal array for json conversion
public
jsonSerialize() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>Last()
Returns last item of array list
public
Last() : mixed
Tags
Map()
Executes an closure for every item and returns new array list
public
Map(Closure $closure) : ArrayList
Parameters
- $closure : Closure
Tags
Return values
ArrayListoffsetExists()
Checks if offset exists in array list (used for ArrayAccess)
public
offsetExists(int $offset) : bool
Parameters
- $offset : int
Tags
Return values
booloffsetGet()
Returns an item at offset position
public
offsetGet(int $offset) : mixed
Parameters
- $offset : int
Tags
offsetSet()
Sets an item by index (used for ArrayAccess)
public
offsetSet(int $offset, mixed $value) : void
Parameters
- $offset : int
- $value : mixed
Tags
offsetUnset()
Deletes an item from array list by index (used for ArrayAccess)
public
offsetUnset(int $offset) : void
Parameters
- $offset : int
Tags
Set()
Sets an item to specified place in array list
public
Set(int $index, mixed $value) : mixed
Parameters
- $index : int
- $value : mixed
Tags
Sort()
Sorts an array list by using internal object field by key
public
Sort([string $k = null ][, int $sorttype = SORT_ASC ]) : void
Parameters
- $k : string = null
- $sorttype : int = SORT_ASC
Tags
SortByClosure()
Sorts an array using sort function
public
SortByClosure(Closure $closure) : self
Parameters
- $closure : Closure
Tags
Return values
selfToArray()
Returns internal array
public
ToArray() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>ToString()
Returns string representation of array list
public
ToString([string $splitter = ',' ]) : string
Parameters
- $splitter : string = ','
-
The delimiter to use when joining elements.
Tags
Return values
string —The string representation of the object.