diff options
author | phecho <phecho@163.com> | 2016-12-21 10:58:41 +0800 |
---|---|---|
committer | phecho <phecho@163.com> | 2016-12-21 10:58:41 +0800 |
commit | 4724367e3b9c10af23bb6596f8f678477927c8c3 (patch) | |
tree | 06ee4e860252222c1784e182d87e22b879451751 /app/Core/Tool.php | |
parent | 56d00ac1592ba5ab7006dfd161f1893e1fdc9bb0 (diff) | |
parent | 9d5d389de841705450190fb1ebbaa11393870dfe (diff) |
Fix conflict
Diffstat (limited to 'app/Core/Tool.php')
-rw-r--r-- | app/Core/Tool.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/app/Core/Tool.php b/app/Core/Tool.php index 9b8820eb..6e457641 100644 --- a/app/Core/Tool.php +++ b/app/Core/Tool.php @@ -41,7 +41,7 @@ class Tool } /** - * Build dependency injection container from an array + * Build dependency injection containers from an array * * @static * @access public @@ -64,6 +64,29 @@ class Tool } /** + * Build dependency injection container from an array + * + * @static + * @access public + * @param Container $container + * @param array $namespaces + * @return Container + */ + public static function buildFactories(Container $container, array $namespaces) + { + foreach ($namespaces as $namespace => $classes) { + foreach ($classes as $name) { + $class = '\\Kanboard\\'.$namespace.'\\'.$name; + $container[lcfirst($name)] = $container->factory(function ($c) use ($class) { + return new $class($c); + }); + } + } + + return $container; + } + + /** * Build dependency injection container for custom helpers from an array * * @static |