Created
December 9, 2014 22:13
-
-
Save cs278/bc154dd4779dc944d6d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Composer\Autoloader\ClassLoader; | |
class loader | |
{ | |
private $loader; | |
private $overlays = array(); | |
public function __construct(ClassLoader $loader, array $overlays) | |
{ | |
$this->loader = $loader; | |
$this->overlays = $overlays; | |
} | |
public function loadClass($class) | |
{ | |
foreach ($this->overlays as $overlay) { | |
$overlayed_class = "$overlay\\$class"; | |
if ($this->loader->loadClass($overlayed_class)) { | |
class_alias($overlayed_class, $class); | |
return true; | |
} | |
} | |
return $this->loadClass($class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment