Passed
Push — master ( 2f1f5f...dd46fb )
by Aleksei
06:02 queued 21s
created

Accessor::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Core\Internal\Introspector;
6
7
use Psr\Container\ContainerInterface;
8
use Spiral\Core\BinderInterface;
9
use Spiral\Core\Config;
10
use Spiral\Core\Container as PublicContainer;
11
use Spiral\Core\FactoryInterface;
12
use Spiral\Core\Internal;
13
use Spiral\Core\InvokerInterface;
14
use Spiral\Core\Options;
15
use Spiral\Core\ResolverInterface;
16
17
/**
18
 * @internal
19
 *
20
 * @property-read Internal\State $state
21
 * @property-read ResolverInterface|Internal\Resolver $resolver
22
 * @property-read FactoryInterface|Internal\Factory $factory
23
 * @property-read ContainerInterface|Internal\Container $container
24
 * @property-read BinderInterface|Internal\Binder $binder
25
 * @property-read InvokerInterface|Internal\Invoker $invoker
26
 * @property-read Internal\Scope $scope
27
 * @property-read Config $config
28
 * @property-read Options $options
29
 */
30
final class Accessor
31
{
32 2
    public function __construct(
33
        public PublicContainer $publicContainer,
34
    ) {
35 2
    }
36
37 2
    public function __get(string $name): object
38
    {
39 2
        return (fn (PublicContainer $c): object => $c->$name)->call($this->publicContainer, $this->publicContainer);
40
    }
41
}
42