$identityCounter
$identityCounter : mixed
The Global Identity Generator Marker
When the identity is polled, this marker is 'advanced'. It's static to the class, in that way it's unique for each one.
Module Class
The Module class is a leaf structure that contains a path (or path identifier). Each path represented might be relative or absolute, or something entirely different.
Technically it's a string strung up as a tree.
Each Module has it's own path, and it's own directory of other Modules.
The idea is that we can map a namespace item (\Item1\Item2\Item3) to a path so that separate namespace elements have different paths, useful in PSR-4
CHANGELOG
1.0: Created Module - February 21st, 2014 1.1: Refactored Module to CDirectory.php - February 27th, 2014 1.2: Wrapped Module around CDirectory.php - February 27th, 2014 2.0: Refactored and integrated with Primus 2 - October 20th, 2015 3.0: eliminated isPath method reformatted for inclusion in phabstractic - August 2nd, 2016
__construct( $path = null, $identifier = null, array $modules = array(), array $options = array())
The Module Constructor
This accepts an array of modules (ModuleInterface)
Options - prefix: set the identifier prefix for local strict: throw errors
$path | ||
$identifier | ||
array | $modules | A plain array of ModuleInterface compatible objects |
array | $options | An array of options, as keys (see above) |
addToLeafIdentityPath(\Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\AbstractLeaf $root, string $path, \Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\LeafInterface $newLeaf, $delimiter = '/')
Take a root leaf, parse the path, and add the given leaf
Takes a root leaf, calls getFromLeafIdentityPath, and then adds the new leaf to the resulting leaf.
\Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\AbstractLeaf | $root | |
string | $path | |
\Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\LeafInterface | $newLeaf | |
$delimiter |
buildFromArray(array $build = array())
Take an array of Leaves, and create the Tree
Each array will have a data element for the data and then a leaves element whose entries are other data. An empty array ends the sequence
Very recursive
array | $build | Not an array of leaves, but as above |
getAsArray(\Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\AbstractLeaf $root) : array
Return Leaf structure from root as array
See above, does the reverse. This is a good way to see how the above is formatted.
\Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\AbstractLeaf | $root | The root to start at |
getFromLeafIdentityPath(\Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\AbstractLeaf $root, string $path, $delimiter = '/') : \Phabstractic\Data\Types\Phabstractic\Data\Type\Resource\LeafInterface|\Phabstractic\Data\Types\Phabstractic\Data\Types\None
Retrieve a Leaf using a path and a root
This starts at a given root Leaf, and then parses the path (delimited by '/'s) until it reaches the intended Leaf. The path refers to identifiers as stored in the identifier array of the actual Leaf
\Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\AbstractLeaf | $root | The Leaf to begin at |
string | $path | The path to the desired Folder (this/is/a/path) |
$delimiter |
A reference, none on failure
getLeafIdentityPaths(\Phabstractic\Data\Types\Phabstractic\Types\Resource\AbstractLeaf $root, $path = '', $delimiter = '/')
Get Leaf Identifier Paths
This returns a list of all terminating paths
Ex:
[] Leaf7/Leaf8/TestPrefix9 [] Leaf12/Leaf1 [] Leaf19/TestPrefix10/AnotherPrefix4/Leaf76
\Phabstractic\Data\Types\Phabstractic\Types\Resource\AbstractLeaf | $root | The leaf to start at |
$path | A recursive function argument, don't use |
|
$delimiter |
dataBelongsTo( $data, \Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\AbstractLeaf $root, \Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\AbstractLeaf $recurseLeaf = null, $delimiter = '/')
Returns a leaf path that contains the data
NOTE: Only returns the first instance it finds
Okay, this returns a leaf path to the leaf that contains the associated data
$data | The data to find |
|
\Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\AbstractLeaf | $root | The root of the tree |
\Phabstractic\Data\Types\Phabstractic\Data\Types\Resource\AbstractLeaf | $recurseLeaf | Recursive function argument, don't use |
$delimiter |
addLeaf(\Phabstractic\Data\Types\Resource\Phabstractic\Data\Type\Resource\LeafInterface $leaf) : string
Add a leaf to the set of leaves this leaf is connected to
\Phabstractic\Data\Types\Resource\Phabstractic\Data\Type\Resource\LeafInterface | $leaf | The leaf to connect |
The new leaf's local identity
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 |
addModule(\Phabstractic\Loader\Falcraft\Loader\Resource\ModuleInterface $module) : mixed
Add Module - Wrapper
A wrapper function for underlying abstract leaf functionality
\Phabstractic\Loader\Falcraft\Loader\Resource\ModuleInterface | $module | The actual module to add |
What addleaf returns
removeModule(\Phabstractic\Loader\Phabstractic\Loader\Resource\ModuleInterface $module) : mixed
Remove Module - Wrapper
A wrapper function for underlying abstract leaf functionality
\Phabstractic\Loader\Phabstractic\Loader\Resource\ModuleInterface | $module | The local module |
What removeleaf returns
isSubModule(\Phabstractic\Loader\Phabstractic\Loader\Resource\ModuleInterface $module) : boolean
Is Sub Module - Wrapper
A wrapper function for underlying abtract leaf functionality
\Phabstractic\Loader\Phabstractic\Loader\Resource\ModuleInterface | $module | the module |
Are we in the module's 'directory'?
getFromModuleIdentityPath(string $path) : \Phabstractic\Loader\Falcraft\Loader\Module|\Phabstractic\Loader\Falcraft\Data\Types\None
Retrieve a Module using a path from this module
This starts at a given root Module, and then parses the path (delimited by '\'s) until it reaches the intended Module. The path refers to identifiers as stored in the identifier array of the actual Module
string | $path | The path to the desired Module (this\is\a\path) |
A reference, none on failure
addToModuleIdentityPath(string $path, \Phabstractic\Loader\Falcraft\Loader\Resource\ModuleInterface $newModule)
Take this Module, parse the path, and add the given Module
Takes this Module, calls getFromModulePath, and then adds the newModule to the resulting Module.
string | $path | |
\Phabstractic\Loader\Falcraft\Loader\Resource\ModuleInterface | $newModule |