Completed
Push — master ( 591275...24655e )
by Derek Stephen
01:52
created

FieldCollection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 19
ccs 8
cts 9
cp 0.8889
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A findByName() 0 13 3
1
<?php
2
/**
3
 * User: delboy1978uk
4
 * Date: 19/11/2016
5
 * Time: 12:18
6
 */
7
8
namespace Del\Form\Collection;
9
10
use Del\Common\Collection\AbstractCollection;
11
use Del\Common\Collection\CollectionInterface;
12
use Del\Form\Field\FieldInterface;
13
14
class FieldCollection extends AbstractCollection implements CollectionInterface
15
{
16
    /**
17
     * @param $name
18
     */
19 3
    public function findByName($name)
20
    {
21 3
        $this->rewind();
22 3
        while ($this->valid()) {
23
            /** @var FieldInterface $field */
24 2
            $field = $this->current();
25 2
            if($field->getName() == $name) {
26 2
                return $field;
27
            }
28
        }
29 1
        $this->rewind();
30 1
        return null;
31
    }
32
}