IgnoreAnnotation::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3.0416

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 10
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0
cc 3
nc 4
nop 1
crap 3.0416
1
<?php
2
3
namespace Doctrine\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 8
    public function __construct(array $values)
27
    {
28 8
        if (is_string($values['value'])) {
29 6
            $values['value'] = [$values['value']];
30
        }
31 8
        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 8
        $this->names = $values['value'];
36 8
    }
37
}
38