-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevops
More file actions
executable file
·48 lines (39 loc) · 1.76 KB
/
Copy pathdevops
File metadata and controls
executable file
·48 lines (39 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env php
<?php declare(strict_types=1);
/*
* This cli entrypoint sets up the Symfony Console Application and all its dependencies.
* Some of this code is to replace functionality built into the Symfony kernel that we aren't using.
*/
require __DIR__.'/vendor/autoload.php';
use Monolog\ErrorHandler;
use Monolog\Logger;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\EventDispatcher\EventDispatcher;
// Create the event dispatcher - needs to be before container so compiler passes can be created
$dispatcher = new EventDispatcher();
// Create the container
/** @var ContainerBuilder $containerBuilder */
$containerBuilder = require __DIR__.'/config/container.php';
/** @var Logger $logger */
$logger = $containerBuilder->get('Monolog\Logger');
// Enables PHP errors to get to third party logging services
ErrorHandler::register($logger);
// At this point, we can disable php errors since Monolog will handle them (prevents duplicates)
// start-up errors will still go to console and PHP's native log file
ini_set('display_errors', '0');
ini_set('log_errors', '0');
// Set up the Application
$application = new Application('Devops');
$application->setDispatcher($dispatcher);
// Find all Commands in the container, add to Application.
foreach ($containerBuilder->findTaggedServiceIds('console.command') as $serviceId => $tagAttributes) {
/** @var Command $command */
$command = $containerBuilder->get($serviceId);
$application->add($command);
}
/** @var ConsoleOutput $output */
$output = $containerBuilder->get('Symfony\Component\Console\Output\ConsoleOutput');
$application->run(null, $output);