protected function convertArgs($step)
    {
        if ($step instanceof Operator) {
            $arguments = $step->getArguments();
        } else {
            $arguments = $step;
        }

        if (is_array($arguments)) {
            $values = [];
            foreach ($arguments as $key => $args) {
                if ($args instanceof Operator) {
                    if (is_string($key)) {
                        $values[$key] = [$this->cmd.$args->getOperatorName() => $this->convertArgs($args)];
                    } else {
                        $values[] = [$this->cmd.$args->getOperatorName() => $this->convertArgs($args)];
                    }
                } else {
                    if (is_string($key)) {
                        $values[$key] = $this->convertArgs($args);
                    } else {
                        $values[] = $args;
                    }
                }
            }

            return $values;

        } elseif ($arguments instanceof Operator) {
            return [$this->cmd.$arguments->getOperatorName() => $this->convertArgs($arguments)];
        } else {
            return $arguments;
        }
    }
protected function convertArgs($step)
    {
        if ($step instanceof Operator) {
            $arguments = $step->getArguments();
        } else {
            $arguments = $step;
        }

        if (is_array($arguments)) {
            $values = [];
            foreach ($arguments as $key => $args) {
                if ($args instanceof Operator) {
                    if (is_string($key)) {
                        $values[$key] = [$this->cmd.$args->getOperatorName() => $this->convertArgs($args)];
                    } else {
                        $values[] = [$this->cmd.$args->getOperatorName() => $this->convertArgs($args)];
                    }
                } else {
                    if (is_string($key)) {
                        $values[$key] = $this->convertArgs($args);
                    } else {
                        $values[] = $args;
                    }
                }
            }

            return $values;

        } elseif ($arguments instanceof Operator) {
            return [$this->cmd.$arguments->getOperatorName() => $this->convertArgs($arguments)];
        } else {
            return $arguments;
        }
    }
protected function convertArgs ( $ step ) { if ( $ step instanceof Operator ) { $ arguments = $ step -> getArguments ( ) ; } else { $ arguments = $ step ; } if ( is_array ( $ arguments ) ) { $ values = [ ] ; foreach ( $ arguments as $ key => $ args ) { if ( $ args instanceof Operator ) { if ( is_string ( $ key ) ) { $ values [ $ key ] = [ $ this -> cmd . $ args -> getOperatorName ( ) => $ this -> convertArgs ( $ args ) ] ; } else { $ values [ ] = [ $ this -> cmd . $ args -> getOperatorName ( ) => $ this -> convertArgs ( $ args ) ] ; } } else { if ( is_string ( $ key ) ) { $ values [ $ key ] = $ this -> convertArgs ( $ args ) ; } else { $ values [ ] = $ args ; } } } return $ values ; } elseif ( $ arguments instanceof Operator ) { return [ $ this -> cmd . $ arguments -> getOperatorName ( ) => $ this -> convertArgs ( $ arguments ) ] ; } else { return $ arguments ; } }
Recursive convert args

@todo refactor
@param $step
@return array|string
Recursive convert args