`update --prefer-lowest` * * Note that no input definition is bound in the resulting input. */ public static function createInput( string $namespace, InputInterface $previousInput ): InputInterface { $matchResult = preg_match( sprintf( '/^(?.+)?bin (?:(?.+?) )?(?:%1$s|\'%1$s\') (?.+?)(? -- .*)?$/', preg_quote($namespace, '/') ), $previousInput->__toString(), $matches ); if (1 !== $matchResult) { throw InvalidBinInput::forBinInput($previousInput); } $inputParts = array_filter( array_map( 'trim', [ $matches['binCommand'], $matches['preBinOptions2'] ?? '', $matches['preBinOptions'] ?? '', $matches['extraInput'] ?? '', ] ) ); // Move the options present _before_ bin namespaceName to after, but // before the end of option marker (--) if present. $reorderedInput = implode(' ', $inputParts); return new StringInput($reorderedInput); } public static function createNamespaceInput(InputInterface $previousInput): InputInterface { $matchResult = preg_match( '/^(.+?\s?)(--(?: .+)?)?$/', $previousInput->__toString(), $matches ); if (1 !== $matchResult) { throw InvalidBinInput::forNamespaceInput($previousInput); } $inputParts = array_filter( array_map( 'trim', [ $matches[1], '--working-dir=.', $matches[2] ?? '', ] ) ); $newInput = implode(' ', $inputParts); return new StringInput($newInput); } public static function createForwardedCommandInput(InputInterface $input): InputInterface { return new StringInput( sprintf( 'bin all %s', $input->__toString() ) ); } private function __construct() { } }