App
This commit is contained in:
50
app/bootstrap/app.php
Normal file
50
app/bootstrap/app.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
use DI\ContainerBuilder;
|
||||
use ProVM\ComposeManager\Wrapper\Application;
|
||||
|
||||
require_once 'composer.php';
|
||||
|
||||
function buildApp(): Application
|
||||
{
|
||||
$containerBuilder = new ContainerBuilder();
|
||||
|
||||
$folders = [
|
||||
'configs',
|
||||
'setups'
|
||||
];
|
||||
foreach ($folders as $folderName) {
|
||||
$folder = implode(DIRECTORY_SEPARATOR, [
|
||||
__DIR__,
|
||||
$folderName
|
||||
]);
|
||||
if (!file_exists($folder)) {
|
||||
continue;
|
||||
}
|
||||
$files = new FilesystemIterator($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
continue;
|
||||
}
|
||||
$containerBuilder->addDefinitions($file->getPathname());
|
||||
}
|
||||
}
|
||||
|
||||
$app = (new Application)->setContainer($containerBuilder->build());
|
||||
|
||||
$folder = implode(DIRECTORY_SEPARATOR, [
|
||||
__DIR__,
|
||||
'commands'
|
||||
]);
|
||||
if (file_exists($folder)) {
|
||||
$files = new FilesystemIterator($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
continue;
|
||||
}
|
||||
require_once $file->getPathname();
|
||||
}
|
||||
}
|
||||
|
||||
return $app;
|
||||
}
|
||||
return buildApp();
|
Reference in New Issue
Block a user