protected static function buildSubprocessCommand($commandIdentifier, array $settings, array $commandArguments = [])
{
$command = self::buildPhpCommand($settings);
if (isset($settings['core']['subRequestIniEntries']) && is_array($settings['core']['subRequestIniEntries'])) {
foreach ($settings['core']['subRequestIniEntries'] as $entry => $value) {
$command .= ' -d ' . escapeshellarg($entry);
if (trim($value) !== '') {
$command .= '=' . escapeshellarg(trim($value));
}
}
}
$escapedArguments = '';
if ($commandArguments !== []) {
foreach ($commandArguments as $argument => $argumentValue) {
$escapedArguments .= ' ' . escapeshellarg('--' . trim($argument));
if (trim($argumentValue) !== '') {
$escapedArguments .= ' ' . escapeshellarg(trim($argumentValue));
}
}
}
$command .= sprintf(' %s %s %s', escapeshellarg(FLOW_PATH_FLOW . 'Scripts/flow.php'), escapeshellarg($commandIdentifier), trim($escapedArguments));
return trim($command);
}