MagicMethodGenerator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 22
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManager\Generator;
6
7
use ReflectionClass;
8
use function strtolower;
9
10
/**
11
 * Method generator for magic methods
12
 */
13
class MagicMethodGenerator extends MethodGenerator
14
{
15
    /**
16
     * @param mixed[] $parameters
17
     */
18
    public function __construct(ReflectionClass $originalClass, string $name, array $parameters = [])
19 5
    {
20
        parent::__construct(
21 5
            $name,
22 5
            $parameters,
23 5
            self::FLAG_PUBLIC
24 5
        );
25
26
        $this->setReturnsReference(strtolower($name) === '__get');
27 5
28
        if (! $originalClass->hasMethod($name)) {
29 5
            return;
30 2
        }
31
32
        $this->setReturnsReference($originalClass->getMethod($name)->returnsReference());
33 3
    }
34
}
35