RosfinCheck   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getIterator() 0 3 1
A __construct() 0 3 1
A fromArray() 0 3 1
A count() 0 3 1
A toArray() 0 3 1
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