TransformerCollection   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 9 2
A toArray() 0 4 1
1
<?php
2
3
namespace DCP\Mapper;
4
5
use DCP\Mapper\Exception\InvalidArgumentException;
6
7
class TransformerCollection extends Collection
8
{
9
    /**
10
     * @param TransformerInterface $transformer
11
     * @return $this
12
     * @throws InvalidArgumentException
13
     */
14
    public function add($transformer)
15
    {
16
        if (!($transformer instanceof TransformerInterface)) {
17
            throw new InvalidArgumentException('$transformer must be an instance of TransformerInterface');
18
        }
19
20
        parent::add($transformer);
21
        return $this;
22
    }
23
24
    /**
25
     * @return TransformerInterface[]
26
     */
27
    public function toArray()
28
    {
29
        return parent::toArray();
30
    }
31
}
32