AbstractComponent   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 4
c 1
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createAndShow() 0 7 1
1
<?php
2
3
namespace pjpawel\Magis\Helper;
4
5
abstract class AbstractComponent implements ComponentInterface
6
{
7
8
    abstract public function show(): string;
9
10
    /**
11
     * @param mixed ...$args
12
     * @return string
13
     * @throws \ReflectionException
14
     */
15
    public static function createAndShow(mixed ...$args): string
16
    {
17
        /** @var array<int,mixed> $args */
18
        $component = new \ReflectionClass(static::class);
19
        $componentObject = $component->newInstanceArgs($args);
20
        /** @var static $componentObject */
21
        return $componentObject->show();
22
    }
23
}