zumba/symbiosis — pull request #21 by mcloide (2014-07-03 15:21:47+00:00)
Title: Adding support for multiple load of namespaces/paths for plugins

### Issue
An object requires to load the plugins from it's own and another object that is dependent of it. The current manager can't instantiate more than one path making a cross object load impossible to handle.

### Suggested Soluction
Change the current structure of the plugin manager to allow an array to pass as the path where the array structure will be:

```
$path = array(
'\Namespace\To\The\Object' => __DIR__ . '\Path\To\The\Object',
'\Namespace\To\The\Object_2' => __DIR__ . '\Path\To\The\Object_2',
...
'\Namespace\To\The\Object_N' => __DIR__ . '\Path\To\The\Object_N'
);
```

The current ```__constructor``` should be updated and support the way that the ```$path``` and ```$namespace``` variables were being passed before. The ```buildPluginCache``` should be updated to support the path / namespace as an array. The current methods to get path and namespace should be updated to return a string as value and set as deprecated. A new method to get / set the new path format array should be created and unit tests should be updated.

The ```buildPluginCache``` was updated to support ```$this->path``` as an array and it's structure changed a bit so it could:

- use php's ```DirectoryInterator``` that will give a better support to identify ```dot``` directories and other items that aren't files (such as other directories and symbolic links).
- ```try/cacth``` while build the ```$classObjects``` array so if any error is thrown it doesn't block the next path to load plugin's and it can store an error on log.
- the priority sort still remain by Namespace

### Results
- Current tests from the unit tests works as expected (no changes on those)
- New unit tests checking the plugin load works as expected
- As a benchmark previous tests were running giving a ```900ms``` to run all tests and with the suggested changes and new tests it is giving a total time of ```870ms```. This difference might have been accomplished by a couple more checks to exit first.