Skip to content

1.3.0

Choose a tag to compare

@JohnathonKoster JohnathonKoster released this 10 May 00:58
· 62 commits to master since this release
67e0ca4

This release adds a new getArgValues helper method to the ArgumentGroupNode node. This is similar to the existing getValues() utility method, but is smarter about how it breaks argument strings:

<?php

use Stillat\BladeParser\Document\Document;
use Stillat\BladeParser\Document\DocumentCompilerOptions;

$template = <<<'BLADE'
    @js(["one, two", $var1, $var2], $hello, 12345.23, bar, baz, (1,2,3,4,), "foo, bar, baz")
BLADE;

$doc = Document::fromText($template);

// Smartly split the argument string.
$doc->findDirectiveByName('js')
    ->arguments->getArgValues();

The above sample would produce output similar to the following:

Illuminate\Support\Collection {#2538
  all: [
    "["one, two", $var1, $var2]",
    "$hello",
    "12345.23",
    "bar",
    "baz",
    "(1,2,3,4,)",
    ""foo, bar, baz"",
  ],
}