RosfinCheck::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Services\Client;
6
7
use ArrayIterator;
8
use Countable;
9
use Iterator;
10
use IteratorAggregate;
11
12
final class RosfinCheck implements IteratorAggregate, Countable
13
{
14
    private $data;
15
16
    public static function fromArray(array $data): self
17
    {
18
        return new self($data);
19
    }
20
21
    public function count(): int
22
    {
23
        return count($this->data);
24
    }
25
26
    public function getIterator(): Iterator
27
    {
28
        return new ArrayIterator(array_map([RosfinItem::class, 'fromArray'], $this->data));
29
    }
30
31
    public function toArray(): array
32
    {
33
        return $this->data;
34
    }
35
36
    private function __construct(array $data)
37
    {
38
        $this->data = $data;
39
    }
40
}
41