-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathTemplate.php
More file actions
90 lines (75 loc) · 1.97 KB
/
Template.php
File metadata and controls
90 lines (75 loc) · 1.97 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
declare(strict_types=1);
namespace Flowpack\NodeTemplates\Domain\Template;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\SharedModel\Node\NodeName;
use Neos\Flow\Annotations as Flow;
/**
* Evaluated template from the yaml configuration
*
* @Flow\Proxy(false)
*/
class Template implements \JsonSerializable
{
private ?NodeTypeName $type;
private ?NodeName $name;
/**
* @var array<string, mixed>
*/
private array $properties;
private Templates $childNodes;
private mixed $copyFrom;
/**
* @internal
* @param array<string, mixed> $properties
*/
public function __construct(?NodeTypeName $type, ?NodeName $name, array $properties, Templates $childNodes, mixed $copyFrom)
{
$this->type = $type;
$this->name = $name;
$this->properties = $properties;
$this->childNodes = $childNodes;
$this->copyFrom = $copyFrom;
}
public function getType(): ?NodeTypeName
{
return $this->type;
}
public function getName(): ?NodeName
{
return $this->name;
}
/**
* @return array<string, string>
*/
public function getProperties(): array
{
return $this->properties;
}
public function getChildNodes(): Templates
{
return $this->childNodes;
}
public function getCopyFrom(): mixed
{
return $this->copyFrom;
}
public function jsonSerialize(): mixed
{
if ($this->copyFrom) {
return [
'type' => $this->type,
'name' => $this->name,
'properties' => $this->properties,
'childNodes' => $this->childNodes,
'copyFrom' => $this->copyFrom,
];
}
return [
'type' => $this->type,
'name' => $this->name,
'properties' => $this->properties,
'childNodes' => $this->childNodes,
];
}
}