Passed
Push — master ( bf73f2...5f1838 )
by Divine Niiquaye
11:16
created

Annotation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAnnotation() 0 3 1
A __construct() 0 3 1
A __toString() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Biurad opensource projects.
7
 *
8
 * PHP version 7.2 and above required
9
 *
10
 * @author    Divine Niiquaye Ibok <[email protected]>
11
 * @copyright 2019 Biurad Group (https://biurad.com/)
12
 * @license   https://opensource.org/licenses/BSD-3-Clause License
13
 *
14
 * For the full copyright and license information, please view the LICENSE
15
 * file that was distributed with this source code.
16
 */
17
18
namespace Biurad\Annotations\Locate;
19
20
/**
21
 * A representation of annotated reflection type.
22
 *
23
 * @author Divine Niiquaye Ibok <[email protected]>
24
 */
25
abstract class Annotation implements \Stringable
26
{
27
    /** @var iterable<object> */
28
    private $annotations = [];
29
30
    /** @var \ReflectionClass|\ReflectionClassConstant|\ReflectionProperty|\ReflectionFunctionAbstract|\ReflectionParameter */
31
    protected $reflection;
32
33
    /**
34
     * @param iterable<object> $annotations
35
     */
36 7
    public function __construct(iterable $annotations)
37
    {
38 7
        $this->annotations = $annotations;
39 7
    }
40
41
    abstract public function getReflection(): \Reflector;
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 3
    public function __toString(): string
47
    {
48 3
        return $this->reflection->getName();
49
    }
50
51
    /**
52
     * @return iterable<object>
53
     */
54 7
    public function getAnnotation(): iterable
55
    {
56 7
        return $this->annotations;
57
    }
58
}
59