1 | <?php |
||
20 | class IncludeBlock implements BehaviourInterface |
||
21 | { |
||
22 | /** |
||
23 | * Name of block used to represent import context. |
||
24 | */ |
||
25 | const CONTEXT_BLOCK = 'context'; |
||
26 | |||
27 | /** |
||
28 | * Path to be included (see Supervisor createNode). |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $path = ''; |
||
33 | |||
34 | /** |
||
35 | * Import context includes everything between opening and closing tag. |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $context = []; |
||
40 | |||
41 | /** |
||
42 | * Context token. |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | protected $token = []; |
||
47 | |||
48 | /** |
||
49 | * @var Supervisor |
||
50 | */ |
||
51 | protected $supervisor = null; |
||
52 | |||
53 | /** |
||
54 | * @param Supervisor $supervisor |
||
55 | * @param string $path |
||
56 | * @param array $context |
||
57 | * @param array $token |
||
58 | */ |
||
59 | public function __construct( |
||
71 | |||
72 | /** |
||
73 | * Create node to be injected into template at place of tag caused import. |
||
74 | * |
||
75 | * @return Node |
||
76 | */ |
||
77 | public function createNode(): Node |
||
119 | |||
120 | /** |
||
121 | * Pack node context (everything between open and close tag). |
||
122 | * |
||
123 | * @return Node |
||
124 | */ |
||
125 | protected function contextNode(): Node |
||
134 | |||
135 | /** |
||
136 | * Create placeholder block (to be injected with inner blocks defined in context). |
||
137 | * |
||
138 | * @param string $name |
||
139 | * @param string|null $blockID |
||
140 | * |
||
141 | * @return string |
||
142 | */ |
||
143 | protected function createPlaceholder(string $name, string &$blockID = null): string |
||
150 | } |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.