Passed
Pull Request — master (#1045)
by Aleksei
09:49
created

ProxyTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 15
ccs 3
cts 6
cp 0.5
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __call() 0 4 1
A __callStatic() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Core\Internal\Proxy;
6
7
use Spiral\Core\ContainerScope;
8
use Spiral\Core\Exception\Container\ContainerException;
9
10
/**
11
 * @internal
12
 */
13
trait ProxyTrait
14
{
15
    private static string $__container_proxy_alias;
16
    private \Stringable|string|null $__container_proxy_context = null;
17
18 3
    public function __call(string $name, array $arguments)
19
    {
20 3
        return Resolver::resolve(static::$__container_proxy_alias, $this->__container_proxy_context)
0 ignored issues
show
Bug introduced by
Since $__container_proxy_alias is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $__container_proxy_alias to at least protected.
Loading history...
21 3
            ->$name(...$arguments);
22
    }
23
24
    public static function __callStatic(string $name, array $arguments)
25
    {
26
        return Resolver::resolve(static::$__container_proxy_alias)
0 ignored issues
show
Bug introduced by
Since $__container_proxy_alias is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $__container_proxy_alias to at least protected.
Loading history...
27
            ->$name(...$arguments);
28
    }
29
}
30