0 follower

Abstract Class Yiisoft\Yii\Runner\ApplicationRunner

InheritanceYiisoft\Yii\Runner\ApplicationRunner
ImplementsYiisoft\Yii\Runner\RunnerInterface

Provides basic functionality for creating adapters.

Public Methods

Hide inherited methods

Method Description Defined By
__construct() Yiisoft\Yii\Runner\ApplicationRunner
getConfig() Yiisoft\Yii\Runner\ApplicationRunner
getContainer() Yiisoft\Yii\Runner\ApplicationRunner
run() Yiisoft\Yii\Runner\ApplicationRunner
withConfig() Returns a new instance with the specified config instance ConfigInterface. Yiisoft\Yii\Runner\ApplicationRunner
withContainer() Returns a new instance with the specified container instance ContainerInterface. Yiisoft\Yii\Runner\ApplicationRunner

Property Details

Hide inherited properties

$bootstrapGroup protected property
protected string $bootstrapGroup null
$checkEvents protected property
protected boolean $checkEvents null
$configDirectory protected property
protected string $configDirectory 'config'
$configMergePlanFile protected property
protected string $configMergePlanFile '.merge-plan.php'
$configModifiers protected property
protected array $configModifiers = []
$debug protected property
protected boolean $debug null
$diDelegatesGroup protected property
protected string $diDelegatesGroup null
$diGroup protected property
protected string $diGroup null
$diProvidersGroup protected property
protected string $diProvidersGroup null
$diTagsGroup protected property
protected string $diTagsGroup null
$environment protected property
protected string|null $environment null
$eventsGroup protected property
protected string $eventsGroup null
$nestedEventsGroups protected property
protected array $nestedEventsGroups null
$nestedParamsGroups protected property
protected array $nestedParamsGroups null
$paramsGroup protected property
protected string $paramsGroup null
$rootPath protected property
protected string $rootPath null
$vendorDirectory protected property
protected string $vendorDirectory 'vendor'

Method Details

Hide inherited methods

__construct() public method

public __construct( string $rootPath, boolean $debug, boolean $checkEvents, string|null $environment, string $bootstrapGroup, string $eventsGroup, string $diGroup, string $diProvidersGroup, string $diDelegatesGroup, string $diTagsGroup, string $paramsGroup, array $nestedParamsGroups, array $nestedEventsGroups, object[] $configModifiers = [], string $configDirectory 'config', string $vendorDirectory 'vendor', string $configMergePlanFile '.merge-plan.php' ): mixed
$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 \Yiisoft\Config\Config.

$configDirectory string

The relative path from $rootPath to the configuration storage location.

$vendorDirectory string

The relative path from $rootPath to the vendor directory.

$configMergePlanFile string

The relative path from $configDirectory to merge plan.

                public function __construct(
    protected string $rootPath,
    protected bool $debug,
    protected bool $checkEvents,
    protected ?string $environment,
    protected string $bootstrapGroup,
    protected string $eventsGroup,
    protected string $diGroup,
    protected string $diProvidersGroup,
    protected string $diDelegatesGroup,
    protected string $diTagsGroup,
    protected string $paramsGroup,
    protected array $nestedParamsGroups,
    protected array $nestedEventsGroups,
    protected array $configModifiers = [],
    protected string $configDirectory = 'config',
    protected string $vendorDirectory = 'vendor',
    protected string $configMergePlanFile = '.merge-plan.php',
) {
}

            
checkEvents() protected method

protected checkEvents( ): void
throws \Psr\Container\ContainerExceptionInterface|ErrorException|\Psr\Container\NotFoundExceptionInterface

                final protected function checkEvents(): void
{
    if (
        $this->checkEvents
        && null !== $configuration = $this->getConfiguration($this->eventsGroup)
    ) {
        /** @psalm-suppress MixedMethodCall */
        $this->getContainer()
            ->get(ListenerConfigurationChecker::class)
            ->check($configuration);
    }
}

            
getConfig() public method

public getConfig( ): \Yiisoft\Config\ConfigInterface
throws ErrorException

                final public function getConfig(): ConfigInterface
{
    return $this->config ??= $this->createDefaultConfig();
}

            
getConfiguration() protected method

protected getConfiguration( string $name ): array|null
$name string

                final protected function getConfiguration(string $name): ?array
{
    $config = $this->getConfig();
    return $config->has($name) ? $config->get($name) : null;
}

            
getContainer() public method

public getContainer( ): \Psr\Container\ContainerInterface
throws ErrorException|\Yiisoft\Definitions\Exception\InvalidConfigException

                final public function getContainer(): ContainerInterface
{
    $this->container ??= $this->createDefaultContainer();
    if ($this->container instanceof Container) {
        return $this->container->get(ContainerInterface::class);
    }
    return $this->container;
}

            
run() public abstract method

public abstract run( ): void

                abstract public function run(): void;

            
runBootstrap() protected method

protected runBootstrap( ): void
throws ErrorException|RuntimeException

                final protected function runBootstrap(): void
{
    $bootstrapList = $this->getConfiguration($this->bootstrapGroup);
    if (empty($bootstrapList)) {
        return;
    }
    (new BootstrapRunner($this->getContainer(), $bootstrapList))->run();
}

            
withConfig() public method

Returns a new instance with the specified config instance ConfigInterface.

public withConfig( \Yiisoft\Config\ConfigInterface $config ): Yiisoft\Yii\Runner\ApplicationRunner
$config \Yiisoft\Config\ConfigInterface

The config instance.

                final public function withConfig(ConfigInterface $config): static
{
    $new = clone $this;
    $new->config = $config;
    return $new;
}

            
withContainer() public method

Returns a new instance with the specified container instance ContainerInterface.

public withContainer( \Psr\Container\ContainerInterface $container ): Yiisoft\Yii\Runner\ApplicationRunner
$container \Psr\Container\ContainerInterface

The container instance.

                final public function withContainer(ContainerInterface $container): static
{
    $new = clone $this;
    $new->container = $container;
    return $new;
}