40 lines
932 B
PHP
40 lines
932 B
PHP
<?php
|
|
use DI\ContainerBuilder as Builder;
|
|
use Contabilidad\Common\Define\Application;
|
|
|
|
require_once 'composer.php';
|
|
|
|
$builder = new Builder();
|
|
$folders = [
|
|
'settings',
|
|
'setups'
|
|
];
|
|
foreach ($folders as $f) {
|
|
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, $f]);
|
|
if (!file_exists($folder)) {
|
|
continue;
|
|
}
|
|
$files = new DirectoryIterator($folder);
|
|
foreach ($files as $file) {
|
|
if ($file->isDir()) {
|
|
continue;
|
|
}
|
|
$builder->addDefinitions($file->getRealPath());
|
|
}
|
|
}
|
|
$container = $builder->build();
|
|
$app = new Application($container);
|
|
|
|
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, 'commands']);
|
|
if (file_exists($folder)) {
|
|
$files = new DirectoryIterator($folder);
|
|
foreach ($files as $file) {
|
|
if ($file->isDir() or $file->getExtension() != 'php') {
|
|
continue;
|
|
}
|
|
include_once $file->getRealPath();
|
|
}
|
|
}
|
|
|
|
return $app;
|