Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
OlzComponent | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
render | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
getHtml | n/a |
0 / 0 |
n/a |
0 / 0 |
0 |
1 | <?php |
2 | |
3 | namespace Olz\Components\Common; |
4 | |
5 | use Olz\Utils\WithUtilsTrait; |
6 | |
7 | /** |
8 | * @template T |
9 | */ |
10 | abstract class OlzComponent { |
11 | use WithUtilsTrait; |
12 | |
13 | /** @param T $args */ |
14 | public static function render(mixed $args = [], mixed $caller = null): string { |
15 | $class_name = get_called_class(); |
16 | $instance = new $class_name(); |
17 | if ($caller) { |
18 | $instance->setAllUtils($caller->getAllUtils()); |
19 | } |
20 | return $instance->getHtml($args); |
21 | } |
22 | |
23 | /** @param T $args */ |
24 | abstract public function getHtml(mixed $args): string; |
25 | } |