Passed
Pull Request — master (#405)
by Kirill
08:21 queued 04:03
created

AttributeReader::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 2
b 0
f 0
nc 2
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
/**
4
 * This file is part of Spiral Framework package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Attributes;
13
14
use Spiral\Attributes\Internal\Decorator;
15
use Spiral\Attributes\Internal\FallbackAttributeReader;
16
use Spiral\Attributes\Internal\Instantiator\InstantiatorInterface;
17
use Spiral\Attributes\Internal\NativeAttributeReader;
18
19
final class AttributeReader extends Decorator
20
{
21
    /**
22
     * @param InstantiatorInterface|null $instantiator
23
     */
24
    public function __construct(InstantiatorInterface $instantiator = null)
25
    {
26
        $reader = NativeAttributeReader::isAvailable()
27
            ? new NativeAttributeReader($instantiator)
28
            : new FallbackAttributeReader($instantiator)
29
        ;
30
31
        parent::__construct($reader);
32
    }
33
}
34