$conf
$conf : \Phabstractic\Features\Zend\Config\Config
The objects configuration object
Should be an instance of Zend/Config
* Linked List Class
This list offers us a chance to have a sequence of data tied together purely by references. This means that it does NOT utilize an array or array operations, but instead relies on elements that connect to each other in a sequential fashion. This allows us to modify the contents of the list using the elements themselves, or at least their references.
This extends the abstract version with some special PHP functionality including __debugInfo, ArrayAccess methods, Countable, and Iteration over the list.
CHANGELOG
1.0: Created LinkedList data type - July 25th, 2016 1.0.1: implemented configurationinterface - July 31st, 2016
$sentinelElement : \Phabstractic\Data\Types\Resource\Phabstractic\Data\Types\Resource\LinkedListElementInterface
The sentinel element of the list
This is usually the 'beginning' of the list
$currentElement : \Phabstractic\Data\Types\Phabstractic\Data\Types\LinkedListElement
The current item in the list
This is important for Iteration. We step through the list one element at a time in the iterator functions, but we have to remember what element we were last at
configure(array|string|\Phabstractic\Features\Zend\Config\Config $configuration, string $format = null, mixed $context = null) : boolean
Configure An Object
Expects an array for configuration however, you can also pass it a filepath where it will read the information from a file automatically detecting the format using the file extension. You can also pass a Zend/Config object already made.
You can also pass a format specifier (forced format) for use in a if $configuration is a string formatted with such information. E.G. to load from a string in the format ini:
$this->configure($configString, 'ini');
The $context argument is used for any additional reader constructor information, such as the constructor for the 'yaml' format.
NOTE: You can override/extend the classes used for reading formats by identifying an additional array in the property $this->configReaders. This will merge with the standard formats array.
array|string|\Phabstractic\Features\Zend\Config\Config | $configuration | The objects configuration information. |
string | $format | The forced format, or format for configuration string |
mixed | $context | Any additional information for a reader constructor, such as needed for the YAML format. |
True if instantiated
saveSettings(string $file, \Phabstractic\Features\Zend\Config\Writer\WriterInterface $writer = null, boolean $exclusive = true, mixed $context = null)
Save an Object's Configuration to a File
Takes an objects $conf property and writes the information contained therein to a file with a format automatically specified by the filename.
It is possible to retrieve a string of a particular format from this method by specifying the filename '#string' with an extension indicating the desired format, such as '#string.json'.
The $context argument is used for any additional reader constructor information, such as the constructor for the 'yaml' format.
NOTE: You can override/extend the classes used for writing formats by identifying an additional array in the property $this->configWriters. This will merge with the standard formats array.
string | $file | The file path to write to, or '#string.ext' |
\Phabstractic\Features\Zend\Config\Writer\WriterInterface | $writer | The optional writer object supplied to use (such as a MySQL writer) |
boolean | $exclusive | Argument provided to toFile(), file exclusive lock when writing |
mixed | $context | Any additionla writer constructor information (YAML) |
getSettings(string $format, $context = null) : string|boolean
Retrieve an Object's Configuration Information As String
This is a shortcut to ::saveSettings() which specifies a format and forces the return of a string, using the #string.ext filename -see documentation for ::saveSettings()-
string | $format | The format to return, must be supported by ::saveSettings(), use $this->configWriters to support additional formats. |
$context |
The formatted string, or false otherwise
processSettings(\Phabstractic\Features\Zend\Config\Processor\ProcessorInterface $processor)
Process an Object's Configuration
This uses a Zend\Config\Processor implementation to process the configuration information, such as constants. The processor must be supplied and implement ProcessorInterface
NOTE: Edits the $conf object in place.
\Phabstractic\Features\Zend\Config\Processor\ProcessorInterface | $processor | The given processor object |
getSentinelElement() : \Phabstractic\Data\Types\Resource\Phabstarctic\Data\Types\Resource\LinkedListElementInterface
Retrieve 'sentinel' List Element
This is usually the first element in the list
insertElementBefore(\Phabstractic\Data\Types\Resource\LinkedListElementInterface $newElement, \Phabstractic\Data\Types\Resource\LinkedListElementInterface $element = null) : boolean
Insert An Element 'Before' Another Element
If &$element is null, insert at BEGINNING of list
\Phabstractic\Data\Types\Resource\LinkedListElementInterface | $newElement | |
\Phabstractic\Data\Types\Resource\LinkedListElementInterface | $element |
Successful?
insertElementAfter(\Phabstractic\Data\Types\Resource\LinkedListElementInterface $newElement, \Phabstractic\Data\Types\Resource\LinkedListElementInterface $element = null) : boolean
Insert An Element 'After' Another Element
If &$element is null, insert at END of list
\Phabstractic\Data\Types\Resource\LinkedListElementInterface | $newElement | |
\Phabstractic\Data\Types\Resource\LinkedListElementInterface | $element |
Successful?
removeElement(\Phabstractic\Data\Types\Resource\LinkedListElementInterface $element) : boolean
Remove An Element
\Phabstractic\Data\Types\Resource\LinkedListElementInterface | $element |
Successful?
offsetUnset(integer $key) : boolean
Unset the index and value on the list
Note: Like the unset method, this throws no error if the index doesn't exist.
integer | $key | the element counting from zero |
False if the index is improper, or not numeric, true otherwise
__construct(\Phabstractic\Data\Types\LinkedListElement $sentinel = null, array $options = array())
The LinkedList Constructor
This instantiates an empty list, or optionally you can specify a LinkedListElement to set as the sentinel, or starting, element.
Currently available options: strict => whether to output errors or remain silent
\Phabstractic\Data\Types\LinkedListElement | $sentinel | |
array | $options | The options for the list as outlined above |
findElement(mixed $data) : \Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\LinkedListElementInterface
Retrieve element based on data
Returns first element whose data matches the input parameter
mixed | $data | The data to match |
add(integer $index, \Phabstractic\Data\Types\LinkedListElement $newelement) : boolean
Add Element At Index
"Insert the value newval at the specified index"
integer | $index | the index of the element to insert before |
\Phabstractic\Data\Types\LinkedListElement | $newelement |
Is successful?
bottomReference() : \Phabstractic\Data\Types\&Phabstractic\Data\Types\Resource\LinkedListElementInterface
Retrieve The Beginning Of The List As Reference
"Peeks at the node from the beginning of the doubly linked list"
topReference() : \Phabstractic\Data\Types\&Phabstractic\Data\Types\Resource\LinkedListElementInterface
Retrieve The End Of The List As Reference
"Peeks at the node from the end of the doubly linked list"
shiftReference() : \Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\LinkedListElementInterface
Get The Beginning Of The List As Reference
"Shifts a node from the beginning of the doubly linked list"
getElementAtIndex( $index, $strict = false) : \Phabstractic\Data\Types\&Phabstractic\Data\Types\Resource\LinkedListElementInterface
Return The List Element At Index
$index | ||
$strict |
if the index is larger than the list, or the list is empty