Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Engine | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| share | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Engelsystem\Renderer; |
| 6 | |
| 7 | abstract class Engine implements EngineInterface |
| 8 | { |
| 9 | protected array $sharedData = []; |
| 10 | |
| 11 | /** |
| 12 | * @param mixed[]|string $key |
| 13 | */ |
| 14 | public function share(array|string $key, mixed $value = null): void |
| 15 | { |
| 16 | if (!is_array($key)) { |
| 17 | $key = [$key => $value]; |
| 18 | } |
| 19 | |
| 20 | $this->sharedData = array_replace_recursive($this->sharedData, $key); |
| 21 | } |
| 22 | } |