Failed Conditions
Pull Request — new-parser-ast-metadata (#3)
by
unknown
02:29
created

CompositeConstraint   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 17
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A validate() 0 4 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Assembler\Validator\Constraint;
6
7
final class CompositeConstraint implements Constraint
8
{
9
    /** @var Constraint[] */
10
    private $constraints;
11
12 1
    public function __construct(Constraint ...$constraints)
13
    {
14 1
        $this->constraints = $constraints;
15 1
    }
16
17
    /**
18
     * @param mixed $value
19
     */
20 1
    public function validate($value) : void
21
    {
22 1
        foreach ($this->constraints as $constraint) {
23 1
            $constraint->validate($value);
24
        }
25 1
    }
26
}
27