| | <?php |
| |
|
| | namespace Kanboard\Core; |
| |
|
| | use Pimple\Container; |
| | use RecursiveDirectoryIterator; |
| | use RecursiveIteratorIterator; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | class Tool |
| | { |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public static function removeAllFiles($directory, $removeDirectory = true) |
| | { |
| | $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS); |
| | $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); |
| |
|
| | foreach ($files as $file) { |
| | if ($file->isDir()) { |
| | rmdir($file->getRealPath()); |
| | } else { |
| | unlink($file->getRealPath()); |
| | } |
| | } |
| |
|
| | if ($removeDirectory) { |
| | rmdir($directory); |
| | } |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public static function buildDIC(Container $container, array $namespaces) |
| | { |
| | foreach ($namespaces as $namespace => $classes) { |
| | foreach ($classes as $name) { |
| | $class = '\\Kanboard\\'.$namespace.'\\'.$name; |
| | $container[lcfirst($name)] = function ($c) use ($class) { |
| | return new $class($c); |
| | }; |
| | } |
| | } |
| |
|
| | 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; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public static function buildDICHelpers(Container $container, array $namespaces) |
| | { |
| | foreach ($namespaces as $namespace => $classes) { |
| | foreach ($classes as $name) { |
| | $class = '\\Kanboard\\'.$namespace.'\\'.$name; |
| | $container['helper']->register($name, $class); |
| | } |
| | } |
| |
|
| | return $container; |
| | } |
| | } |
| |
|