ValidatorCollection::append()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Del\Form\Collection;
6
7
use Del\Form\Validator\ValidatorInterface;
8
use InvalidArgumentException;
9
10
class ValidatorCollection extends AbstractCollection implements CollectionInterface
11
{
12 27
    public function append(mixed $validator): void
13
    {
14 27
        if (!$validator instanceof ValidatorInterface) {
15 1
            throw new InvalidArgumentException('You can only append a Del\Form\Validator\ValidatorInterface.');
16
        }
17 26
        parent::append($validator);
18
    }
19
20 24
    public function current(): mixed
21
    {
22 24
        return parent::current();
23
    }
24
}
25