Completed
Push — master ( ed4933...1b245d )
by Freek
14s queued 12s
created

CompileRenderDirective::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Spatie\ViewComponents;
4
5
final class CompileRenderDirective
6
{
7
    public function __invoke(string $expression): string
8
    {
9
        $expressionParts = explode(',', $expression, 2);
10
11
        $componentPath = $expressionParts[0];
12
        $props = trim($expressionParts[1] ?? '[]');
13
14
        return "<?php echo app(app(Spatie\ViewComponents\ComponentFinder::class)->find({$componentPath}), {$props})->toHtml(); ?>";
15
    }
16
}
17