$conf
$conf : \Phabstractic\Features\Zend\Config\Config
The objects configuration object
Should be an instance of Zend/Config
The Abstract Autoloader
This piece of machinery keeps track of paths, prefixes, libraries and Modules
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 |
__construct(array $paths = array(), array $options = array())
Abstract Loader Constructor
This takes in an array of paths (NOT identifiers, actual paths) and an array of options. It sets up the paths into appropriate objects and sets up the library root Module.
OPTIONS - strict: do we throw errors? auto_register: Register the load in the SPL (false default) file_extension: What file extension to use as a base for paths
array | $paths | The actual PATHS to put in the autoloader |
array | $options | See description |
removePath(string $path) : boolean
Removes a path from the path pool, but only if it's not tied to a Module
This function servers the opposite functionality of the addPath function. If a path doesn't exist, it does nothing
string | $path | The path to exclude/remove |
On success or failure
getPathObjectReference(string $searchPath) : \Phabstractic\Loader\Resource\Phabstractic\Data\Components\Path
Retrieve a reference to path object by path
string | $searchPath | The path we're looking for |
removePrefix(string|integer $path, string $prefix) : boolean
Remove a prefix from a path
Automatically de-couples the prefix from all assigned paths
string|integer | $path | The path to remove the prefix from |
string | $prefix | The given prefix |
true on success, or false on failure
addNamespace(string $namespace, string $path) : boolean
Register namespace with the autoloader
This function can be used in multiple ways depending on the autoloader. It is meant to be use as a sort of an additional include path linked to a given library/vendor name
string | $namespace | The base namespace |
string | $path | The include path |
True on success
removeNamespace(string $namespace) : boolean
Unregister a namespace with the autoloader
Performs the opposite functionality of the addLibrary method
Returns false if Module is not present in autoloader
string | $namespace | The library path/identifier |
True on successful removal
getNamespaceModule( $namespace) : \Phabstractic\Loader\Resource\&Phabstractic\Loader\Resource\ModuleInterface
Retrieve the module reference associated with namespace
Pre-pend the namespace with a '\'!
$namespace |