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

ValidatorCollection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 21
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A current() 0 3 1
A append() 0 7 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
}