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

ValidatorCollection::current()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
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
}