79408776

Date: 2025-02-03 12:17:43
Score: 0.5
Natty:
Report link

big thanks to TomasVotruba found another solution by getting array with nodeFinder and then transformConcatToStringArray()

$array = $this->nodeFinder->findFirstInstanceOf($node, Array_::class);
$class_args = [];
$class_items = new Array_();
foreach ($array->items as $arrayItem) {
    $arr_key_name = $arrayItem->key->value;
    if($arrayItem->value instanceof Concat){
        $class_array = $this->NodeTransformer->transformConcatToStringArray($arrayItem->value);
        foreach ($class_array->items as $key_row => $row){
            if($row->value instanceof Variable)
                continue;
            if(count($class_array->items) > $key_row && $class_array->items[$key_row+1]->value instanceof Variable){
                $class_items->items[] = new ArrayItem(new Concat($row->value, $class_array->items[$key_row+1]->value));
                continue;
            }
            $class_items->items[] = new ArrayItem($row->value);
        }
        $class_args[] = new Arg($class_items);
        $new_function = new MethodCall($new_function, $arr_key_name, $class_args);
    }
}

<?php echo html()->button('<i class="fa ' . $actionBtnIcon . '" aria-hidden="true"></i> ' . $btnSubmitText)->type(['button'])->id(['confirm'])->class(['btn', 'btn-' . $modalClass, 'pull-right', 'btn-flat']) ?>

Reasons:
  • Blacklisted phrase (0.5): thanks
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Dmitry Vasilyev