Total Complexity | 8 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class ViewOperations |
||
9 | { |
||
10 | public static function merge(ViewInterface... $views): View |
||
11 | { |
||
12 | $target = new View(); |
||
13 | foreach ($views as $view) { |
||
14 | $target |
||
15 | ->setChildViews($view->getChildViews()) |
||
16 | ->setAppendChildViews($view->shouldAppendChildViews()); |
||
17 | if ($view->getType()) { |
||
|
|||
18 | $target->setType($view->getType()); |
||
19 | } |
||
20 | if ($view->getTargetEntity()) { |
||
21 | $target->setTargetEntity($view->getTargetEntity()); |
||
22 | } |
||
23 | foreach ($view->getParameters() as $parameter => $value) { |
||
24 | $target->setParameter($parameter, $value); |
||
25 | } |
||
26 | } |
||
27 | return $target; |
||
28 | } |
||
29 | |||
30 | public static function from(ViewInterface $view): View |
||
31 | { |
||
32 | return static::merge($view); |
||
33 | } |
||
34 | |||
35 | public static function toMutable(ViewInterface $view): View |
||
38 | } |
||
39 | } |
||
40 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: