@@ 30-40 (lines=11) @@ | ||
27 | { |
|
28 | \Blade::directive( |
|
29 | 'macro', |
|
30 | function ($expression) { |
|
31 | $pattern = '/(\([\'|\"](\w+)[\'|\"],\s*(([^\@])+|(.*))\))/xim'; |
|
32 | $matches = []; |
|
33 | preg_match_all($pattern, $expression, $matches); |
|
34 | ||
35 | if (!isset($matches[3][0])) { |
|
36 | throw new \InvalidArgumentException(sprintf('Invalid arguments in blade: macro%s', $expression)); |
|
37 | } |
|
38 | ||
39 | return sprintf("<?php \$___tiny['%s']=function(%s)use(\$__env){ ob_start(); ?>\n", $matches[2][0], $matches[3][0]); |
|
40 | } |
|
41 | ); |
|
42 | ||
43 | \Blade::directive( |
|
@@ 52-62 (lines=11) @@ | ||
49 | ||
50 | \Blade::directive( |
|
51 | 'usemacro', |
|
52 | function ($expression) { |
|
53 | $pattern = '/(\([\'|\"](\w+)[\'|\"],\s*(([^\@])+|(.*))\))/xim'; |
|
54 | $matches = []; |
|
55 | preg_match_all($pattern, $expression, $matches); |
|
56 | ||
57 | if (!isset($matches[3][0])) { |
|
58 | throw new \InvalidArgumentException(sprintf('Invalid arguments in blade: usemacro%s', $expression)); |
|
59 | } |
|
60 | ||
61 | return sprintf("<?php echo \$___tiny['%s'](%s); ?>\n", $matches[2][0], $matches[3][0]); |
|
62 | } |
|
63 | ); |
|
64 | ||
65 | \Blade::directive( |