Passed
Push — master ( acf3f9...98cfe3 )
by Derek Stephen
03:04
created

ValidatorCollection::append()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
/**
3
 * User: delboy1978uk
4
 * Date: 27/11/2016
5
 * Time: 13:41
6
 */
7
8
namespace Del\Form\Collection;
9
10
use Del\Form\Validator\ValidatorInterface;
11
use InvalidArgumentException;
12
13
class ValidatorCollection extends AbstractCollection implements CollectionInterface
14
{
15
    /**
16
     * @param ValidatorInterface $validator Pass in a validator
17
     * @return $this
18
     */
19 26
    public function append($validator)
20
    {
21 26
        if (!$validator instanceof ValidatorInterface) {
0 ignored issues
show
introduced by
$validator is always a sub-type of Del\Form\Validator\ValidatorInterface.
Loading history...
22 1
            throw new InvalidArgumentException('You can only append a Del\Form\Validator\ValidatorInterface.');
23
        }
24 25
        parent::append($validator);
25 25
        return $this;
26
    }
27
28
    /**
29
     * @return ValidatorInterface
30
     */
31 23
    public function current()
32
    {
33 23
        return parent::current();
34
    }
35
}