0 follower

Final Class Yiisoft\Yii\Runner\Console\ConsoleApplicationRunner

InheritanceYiisoft\Yii\Runner\Console\ConsoleApplicationRunner » Yiisoft\Yii\Runner\ApplicationRunner

ConsoleApplicationRunner runs the Yii console application.

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( string $rootPath, boolean $debug false, boolean $checkEvents false, string|null $environment null, string $bootstrapGroup 'bootstrap-console', string $eventsGroup 'events-console', string $diGroup 'di-console', string $diProvidersGroup 'di-providers-console', string $diDelegatesGroup 'di-delegates-console', string $diTagsGroup 'di-tags-console', string $paramsGroup 'params-console', array $nestedParamsGroups = ['params'], array $nestedEventsGroups = ['events'], object[] $configModifiers = [], string $configDirectory 'config', string $vendorDirectory 'vendor', string $configMergePlanFile '.merge-plan.php' )
$rootPath string

The absolute path to the project root.

$debug boolean

Whether the debug mode is enabled.

$checkEvents boolean

Whether to check events' configuration.

$environment string|null

The environment name.

$bootstrapGroup string

The bootstrap configuration group name.

$eventsGroup string

The events' configuration group name.

$diGroup string

The container definitions' configuration group name.

$diProvidersGroup string

The container providers' configuration group name.

$diDelegatesGroup string

The container delegates' configuration group name.

$diTagsGroup string

The container tags' configuration group name.

$paramsGroup string

The configuration parameters group name.

$nestedParamsGroups array

Configuration group names that are included into configuration parameters group. This is needed for recursive merging of parameters.

$nestedEventsGroups array

Configuration group names that are included into events' configuration group. This is needed for reverse and recursive merge of events' configurations.

$configModifiers object[]

Modifiers for {@see \Yiisoft\Yii\Runner\Console\Config}.

$configDirectory string

The relative path from {@see $rootPath} to the configuration storage location.

$vendorDirectory string

The relative path from {@see $rootPath} to the vendor directory.

$configMergePlanFile string

The relative path from {@see $configDirectory} to merge plan.

                public function __construct(
    string $rootPath,
    bool $debug = false,
    bool $checkEvents = false,
    ?string $environment = null,
    string $bootstrapGroup = 'bootstrap-console',
    string $eventsGroup = 'events-console',
    string $diGroup = 'di-console',
    string $diProvidersGroup = 'di-providers-console',
    string $diDelegatesGroup = 'di-delegates-console',
    string $diTagsGroup = 'di-tags-console',
    string $paramsGroup = 'params-console',
    array $nestedParamsGroups = ['params'],
    array $nestedEventsGroups = ['events'],
    array $configModifiers = [],
    string $configDirectory = 'config',
    string $vendorDirectory = 'vendor',
    string $configMergePlanFile = '.merge-plan.php',
) {
    parent::__construct(
        $rootPath,
        $debug,
        $checkEvents,
        $environment,
        $bootstrapGroup,
        $eventsGroup,
        $diGroup,
        $diProvidersGroup,
        $diDelegatesGroup,
        $diTagsGroup,
        $paramsGroup,
        $nestedParamsGroups,
        $nestedEventsGroups,
        $configModifiers,
        $configDirectory,
        $vendorDirectory,
        $configMergePlanFile,
    );
}

            
run() public method

public run ( )
throws \Yiisoft\Definitions\Exception\CircularReferenceException|ErrorException|Exception|\Yiisoft\Definitions\Exception\InvalidConfigException
throws \Psr\Container\ContainerExceptionInterface|\Yiisoft\Di\NotFoundException|\Psr\Container\NotFoundExceptionInterface|\Yiisoft\Definitions\Exception\NotInstantiableException

                public function run(): void
{
    $this->runBootstrap();
    $this->checkEvents();
    /** @var Application $application */
    $application = $this->getContainer()->get(Application::class);
    $exitCode = ExitCode::UNSPECIFIED_ERROR;
    $input = new ArgvInput();
    $output = new ConsoleBufferedOutput();
    try {
        $application->start($input);
        $exitCode = $application->run($input, $output);
    } catch (Throwable $throwable) {
        $application->renderThrowable($throwable, $output);
    } finally {
        $application->shutdown($exitCode);
        exit($exitCode);
    }
}