summaryrefslogtreecommitdiff
path: root/app/Core
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-09-15 22:35:56 +0200
committerFrédéric Guillot <fred@kanboard.net>2014-09-15 22:35:56 +0200
commite1ddf7f0127e9745f94e5ff9f76ea828e9058720 (patch)
tree46ae9b2397162cff54813dd840c340e85aaf53fe /app/Core
parent5f962bf4cd7ef69f2a0873cbebdce83d35b086a5 (diff)
Run unit tests across different database backends + fix bugs
Diffstat (limited to 'app/Core')
-rw-r--r--app/Core/Loader.php33
1 files changed, 29 insertions, 4 deletions
diff --git a/app/Core/Loader.php b/app/Core/Loader.php
index 7c437654..151081c1 100644
--- a/app/Core/Loader.php
+++ b/app/Core/Loader.php
@@ -11,17 +11,29 @@ namespace Core;
class Loader
{
/**
+ * List of paths
+ *
+ * @access private
+ * @var array
+ */
+ private $paths = array();
+
+ /**
* Load the missing class
*
* @access public
- * @param string $class Class name
+ * @param string $class Class name with namespace
*/
public function load($class)
{
- $filename = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
+ foreach ($this->paths as $path) {
+
+ $filename = $path.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
- if (file_exists($filename)) {
- require $filename;
+ if (file_exists($filename)) {
+ require $filename;
+ break;
+ }
}
}
@@ -34,4 +46,17 @@ class Loader
{
spl_autoload_register(array($this, 'load'));
}
+
+ /**
+ * Register a new path
+ *
+ * @access public
+ * @param string $path Path
+ * @return Core\Loader
+ */
+ public function setPath($path)
+ {
+ $this->paths[] = $path;
+ return $this;
+ }
}