1 | <?php |
||
20 | class ComposerLocator implements LocatorInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var ClassLoader |
||
24 | */ |
||
25 | private $loader; |
||
26 | |||
27 | public function __construct(ClassLoader $loader = null) |
||
28 | { |
||
29 | if (!$loader) { |
||
30 | $loaders = spl_autoload_functions(); |
||
31 | foreach ($loaders as $loader) { |
||
32 | if (is_array($loader) && $loader[0] instanceof ClassLoader) { |
||
33 | $loader = $loader[0]; |
||
34 | break; |
||
35 | } |
||
36 | } |
||
37 | if (!$loader) { |
||
38 | throw new ReflectionException("Can not found a correct composer loader"); |
||
39 | } |
||
40 | } |
||
41 | $this->loader = $loader; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Returns a path to the file for given class name |
||
46 | * |
||
47 | * @param string $className Name of the class |
||
48 | * |
||
49 | * @return string|false Path to the file with given class or false if not found |
||
50 | */ |
||
51 | public function locateClass($className) |
||
55 | } |
||
56 |