Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Engine
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 share
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace Engelsystem\Renderer;
6
7abstract 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}