|
@@ -11,6 +11,8 @@
|
|
|
|
|
|
namespace Symfony\Component\ClassLoader;
|
|
|
|
|
|
+require_once __DIR__.'/ClassLoaderInterface.php';
|
|
|
+
|
|
|
/**
|
|
|
* A class loader that uses a mapping file to look up paths.
|
|
|
*
|
|
@@ -18,7 +20,7 @@ namespace Symfony\Component\ClassLoader;
|
|
|
*
|
|
|
* @api
|
|
|
*/
|
|
|
-class MapFileClassLoader
|
|
|
+class MapFileClassLoader implements ClassLoaderInterface
|
|
|
{
|
|
|
private $map = array();
|
|
|
|
|
@@ -61,4 +63,22 @@ class MapFileClassLoader
|
|
|
require $this->map[$class];
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Finds the path to the file where the class is defined.
|
|
|
+ *
|
|
|
+ * @param string $class The name of the class
|
|
|
+ *
|
|
|
+ * @return string|null The path, if found
|
|
|
+ */
|
|
|
+ public function findFile($class)
|
|
|
+ {
|
|
|
+ if ('\\' === $class[0]) {
|
|
|
+ $class = substr($class, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isset($this->map[$class])) {
|
|
|
+ return $this->map[$class];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|