final class CommandInvoker (View source)

Executes a command inside a fresh command scope with invocation-specific services.

Methods

Creates an invoker backed by the application's scope factory.

int
invoke(CommandDefinition $definition, array $argv, array $args, CommandOutput $output)

Resolves and runs the selected command, always closing its scope afterward.

int

Details

__construct

__construct(ScopeFactoryInterface $scopeFactory)

Creates an invoker backed by the application's scope factory.

Parameters

ScopeFactoryInterface $scopeFactory

invoke

int invoke(CommandDefinition $definition, array $argv, array $args, CommandOutput $output)

Resolves and runs the selected command, always closing its scope afterward.

Exceptions from command resolution or execution propagate after the scope is closed.

Parameters

CommandDefinition $definition
array $argv

Complete argument vector received by the CLI kernel.

array $args

Arguments after the executable and command name.

CommandOutput $output

Return Value

int

Exceptions

RuntimeException