DockerComposeCommandBuilder
in package
Builds Docker Compose commands for redirected Composer scripts.
Table of Contents
Methods
- buildRunningServicesCommand() : array<int, string>
- Builds the Docker Compose running services command.
- buildScriptCommand() : array<int, string>
- Builds the Docker Compose script execution command.
- buildUpCommand() : array<int, string>
- Builds the Docker Compose service startup command.
- composeBase() : array<int, string>
- Builds the common Docker Compose command prefix.
- composerRunScriptCommand() : array<int, string>
- Builds the Composer run-script command for the container.
- stringifyArgument() : string
- Converts a Composer script argument to a command string.
Methods
buildRunningServicesCommand()
Builds the Docker Compose running services command.
public
buildRunningServicesCommand(DockerComposerConfig $config) : array<int, string>
Parameters
- $config : DockerComposerConfig
-
The Docker Composer configuration that provides service options.
Return values
array<int, string> —Returns command arguments for docker compose ps.
buildScriptCommand()
Builds the Docker Compose script execution command.
public
buildScriptCommand(DockerComposerConfig $config, Event $event, bool $interactive) : array<int, string>
Parameters
- $config : DockerComposerConfig
-
The Docker Composer configuration that provides service options.
- $event : Event
-
The Composer script event to replay inside Docker Compose.
- $interactive : bool
-
Whether the Docker command should keep TTY interaction enabled.
Return values
array<int, string> —Returns command arguments for docker compose exec or run.
buildUpCommand()
Builds the Docker Compose service startup command.
public
buildUpCommand(DockerComposerConfig $config) : array<int, string>
Parameters
- $config : DockerComposerConfig
-
The Docker Composer configuration that provides service options.
Return values
array<int, string> —Returns command arguments for docker compose up -d.
composeBase()
Builds the common Docker Compose command prefix.
private
composeBase(DockerComposerConfig $config) : array<int, string>
Parameters
- $config : DockerComposerConfig
-
The configuration that provides compose files and project directory.
Return values
array<int, string> —Returns base arguments beginning with docker compose.
composerRunScriptCommand()
Builds the Composer run-script command for the container.
private
composerRunScriptCommand(Event $event) : array<int, string>
Parameters
- $event : Event
-
The script event whose name, flags, and arguments are replayed.
Return values
array<int, string> —Returns command arguments beginning with composer run-script.
stringifyArgument()
Converts a Composer script argument to a command string.
private
stringifyArgument(mixed $argument) : string
Parameters
- $argument : mixed
-
The script argument provided by Composer.
Return values
string —Returns the scalar value converted for the shell command array.