Permalink
Browse files

[ClassLoader] Add ability to incrementally register fallbacks.

This is useful in the cases where you might be adding forward compat
classes to several components.
  • Loading branch information...
Drak
Drak committed Feb 16, 2012
1 parent 3c683c9 commit 3200473a1912d6767078395bca3b0b90cded916d
Showing with 21 additions and 1 deletion.
  1. +21 −1 UniversalClassLoader.php
View
@@ -141,7 +141,17 @@ public function registerNamespaceFallbacks(array $dirs)
}
/**
- * Registers the directory to use as a fallback for class prefixes.
+ * Registers a directory to use as a fallback for namespaces.
+ *
+ * @param string $dir A directory
+ */
+ public function registerNamespaceFallback($dir)
+ {
+ $this->namespaceFallbacks[] = $dir;
+ }
+
+ /**
+ * Registers directories to use as a fallback for class prefixes.
*
* @param array $dirs An array of directories
*
@@ -152,6 +162,16 @@ public function registerPrefixFallbacks(array $dirs)
$this->prefixFallbacks = $dirs;
}
+ /**
+ * Registers a directory to use as a fallback for class prefixes.
+ *
+ * @param string $dir A directory
+ */
+ public function registerPrefixFallback($dir)
+ {
+ $this->prefixFallbacks[] = $dir;
+ }
+
/**
* Registers an array of namespaces
*

0 comments on commit 3200473

Please sign in to comment.