public static function build($command, array $args = []): string
    {
        $stringArgs = [];
        $realCommand = $command;

        if (count($args) > 0) {
            foreach ($args as $key => $value) {
                $value = trim($value);
                $key = trim($key);

                if (strpos($key, '-') !== 0) {
                    $key = strlen($key) === 1 ? '-' . $key : '--' . $key;
                }

                if (strlen($value) > 0) {
                    $stringArgs[] = $key . '="' . addcslashes($value, '"') . '"';
                } else {
                    $stringArgs[] = $key;
                }
            }
        }

        if (count($stringArgs)) {
            $realCommand = $command . ' ' . implode(' ', $stringArgs);
        }

        return $realCommand;
    }
public static function build($command, array $args = []): string
    {
        $stringArgs = [];
        $realCommand = $command;

        if (count($args) > 0) {
            foreach ($args as $key => $value) {
                $value = trim($value);
                $key = trim($key);

                if (strpos($key, '-') !== 0) {
                    $key = strlen($key) === 1 ? '-' . $key : '--' . $key;
                }

                if (strlen($value) > 0) {
                    $stringArgs[] = $key . '="' . addcslashes($value, '"') . '"';
                } else {
                    $stringArgs[] = $key;
                }
            }
        }

        if (count($stringArgs)) {
            $realCommand = $command . ' ' . implode(' ', $stringArgs);
        }

        return $realCommand;
    }
public static function build ( $ command , array $ args = [ ] ) : string { $ stringArgs = [ ] ; $ realCommand = $ command ; if ( count ( $ args ) > 0 ) { foreach ( $ args as $ key => $ value ) { $ value = trim ( $ value ) ; $ key = trim ( $ key ) ; if ( strpos ( $ key , '-' ) !== 0 ) { $ key = strlen ( $ key ) === 1 ? '-' . $ key : '--' . $ key ; } if ( strlen ( $ value ) > 0 ) { $ stringArgs [ ] = $ key . '="' . addcslashes ( $ value , '"' ) . '"' ; } else { $ stringArgs [ ] = $ key ; } } } if ( count ( $ stringArgs ) ) { $ realCommand = $ command . ' ' . implode ( ' ' , $ stringArgs ) ; } return $ realCommand ; }
Build params for cli options

@param string $command
@param array  $args
@return string
Build params for cli options