DepositCollection   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 26
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A push() 0 7 2
1
<?php
2
3
namespace MidasSoft\DominicanBankParser\Collections;
4
5
use MidasSoft\DominicanBankParser\Deposit;
6
use MidasSoft\DominicanBankParser\Exceptions\InvalidArgumentException;
7
use Tightenco\Collect\Support\Collection;
8
9
class DepositCollection extends Collection
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14 13
    public function __construct($items = [])
15
    {
16
        array_walk($items, function ($value) {
17 1
            if (!$value instanceof Deposit) {
18
                throw new InvalidArgumentException('You should pass only Deposit objects to this collection.');
19
            }
20 13
        });
21
22 13
        parent::__construct($items);
23 13
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 8
    public function push($value)
29
    {
30 8
        if (!$value instanceof Deposit) {
31
            throw new InvalidArgumentException('You should pass only Deposit objects to this collection.');
32
        }
33
34 8
        parent::push($value);
35 8
    }
36
}
37