Completed
Push — master ( 701667...7c8a36 )
by Peter
01:54
created

CollectionDto::getIterator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace PtrTn\Battlerite\Dto;
4
5
use Countable;
6
use IteratorAggregate;
7
use Webmozart\Assert\Assert;
8
9
abstract class CollectionDto implements IteratorAggregate, Countable
10
{
11
    /**
12
     * @var array
13
     */
14
    public $items;
15
16 9
    protected function __construct(string $class, array $items)
17
    {
18 9
        Assert::allIsInstanceOf($items, $class);
19
20 9
        $this->items = $items;
21 9
    }
22
23 2
    public function count(): int
24
    {
25 2
        return count($this->items);
26
    }
27
}
28