DecoratorTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 17
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __call() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Pgs\HashIdBundle\Traits;
6
7
use BadMethodCallException;
8
9
trait DecoratorTrait
10
{
11
    protected $object;
12
13
    /**
14
     * @throws BadMethodCallException
15
     *
16
     * @return mixed
17
     */
18 2
    public function __call(string $method, array $arguments)
19
    {
20 2
        if (!method_exists($this->object, $method)) {
21 1
            $message = sprintf('Object %s has no %s() method.', \get_class($this->object), $method);
22 1
            throw new BadMethodCallException($message);
23
        }
24
25 1
        return \call_user_func_array([$this->object, $method], $arguments);
26
    }
27
}
28