IgnoreAnnotation::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 10
rs 10
c 0
b 0
f 0
cc 3
nc 4
nop 1
1
<?php
2
3
namespace Doctrine\Common\Annotations\Annotation;
4
5
/**
6
 * Annotation that can be used to signal to the parser to ignore specific
7
 * annotations during the parsing process.
8
 *
9
 * @Annotation
10
 * @author Johannes M. Schmitt <[email protected]>
11
 */
12
final class IgnoreAnnotation
13
{
14
    /**
15
     * @var array
16
     */
17
    public $names;
18
19
    /**
20
     * Constructor.
21
     *
22
     * @param array $values
23
     *
24
     * @throws \RuntimeException
25
     */
26
    public function __construct(array $values)
27
    {
28
        if (is_string($values['value'])) {
29
            $values['value'] = [$values['value']];
30
        }
31
        if (!is_array($values['value'])) {
32
            throw new \RuntimeException(sprintf('@IgnoreAnnotation expects either a string name, or an array of strings, but got %s.', json_encode($values['value'])));
33
        }
34
35
        $this->names = $values['value'];
36
    }
37
}
38