| Total Complexity | 7 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Tpl |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var array |
||
| 15 | */ |
||
| 16 | private static $assign = []; |
||
| 17 | /** |
||
| 18 | * @var null |
||
| 19 | */ |
||
| 20 | private static $engine = null; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @return Engine |
||
| 24 | */ |
||
| 25 | 2 | private static function engine(): Engine |
|
| 26 | { |
||
| 27 | 2 | if (!isset(self::$engine) || is_null(self::$engine)) { |
|
| 28 | 2 | self::$engine = new Engine; |
|
|
|
|||
| 29 | } |
||
| 30 | |||
| 31 | 2 | return self::$engine; |
|
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param array $config |
||
| 36 | * @throws \Exception |
||
| 37 | */ |
||
| 38 | 2 | public static function config(array $config): void |
|
| 39 | { |
||
| 40 | 2 | self::engine()->config($config); |
|
| 41 | 2 | } |
|
| 42 | |||
| 43 | /** |
||
| 44 | * @param string $key |
||
| 45 | * @param $value |
||
| 46 | */ |
||
| 47 | 2 | public static function assign(string $key, $value): void |
|
| 48 | { |
||
| 49 | 2 | if (is_array($value)) { |
|
| 50 | 2 | $value = json_decode(json_encode($value), false); |
|
| 51 | } |
||
| 52 | |||
| 53 | 2 | self::$assign[$key] = $value; |
|
| 54 | 2 | } |
|
| 55 | |||
| 56 | /** |
||
| 57 | * @param string $template |
||
| 58 | * @return string |
||
| 59 | */ |
||
| 60 | 2 | public static function render(string $template): string |
|
| 63 | } |
||
| 64 | } |
||
| 65 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..