-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPipelineBuilder.php
38 lines (33 loc) · 997 Bytes
/
PipelineBuilder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
declare(strict_types=1);
namespace Kiboko\Component\Satellite\Builder\API;
use PhpParser\Builder;
use PhpParser\Node;
final readonly class PipelineBuilder
{
public function __construct(private Builder $builder)
{
}
public function getNode(): Node\Expr
{
return new Node\Expr\Closure(
subNodes: [
'static' => true,
'params' => [
new Node\Param(
var: new Node\Expr\Variable('runtime'),
type: new Node\Name\FullyQualified('Kiboko\Component\Runtime\Hook\HookRuntimeInterface'),
),
],
'stmts' => [
new Node\Stmt\Expression(
$this->builder->getNode()
),
new Node\Stmt\Return_(
expr: new Node\Expr\Variable('runtime')
),
],
]
);
}
}