Improved plugin loading

This commit is contained in:
Shoghi Cervantes 2014-04-04 22:11:31 +02:00
parent adcbc67a71
commit 0d91be62cf
2 changed files with 10 additions and 2 deletions

View File

@ -58,7 +58,7 @@ class PharPluginLoader implements PluginLoader{
}
$file = "phar://$file";
$className = $description->getMain();
$this->server->getLoader()->add(substr($className, 0, strpos($className, "\\")), array(
$this->server->getLoader()->add(substr($className, 0, strrpos($className, "\\")), array(
"$file/src"
));

View File

@ -122,7 +122,15 @@ class SplClassLoader implements SplAutoloader{
* {@inheritdoc}
*/
public function add($resource, $resourcePath = null){
$this->resources[$resource] = (array) $resourcePath;
if(isset($this->resources[$resource])){
foreach((array) $resourcePath as $path){
if(!in_array($path, $this->resources[$resource], true)){
$this->resources[$resource][] = $path;
}
}
}else{
$this->resources[$resource] = (array) $resourcePath;
}
}
/**