Passed
Pull Request — master (#32)
by Artem
07:12
created

PaymentRecords   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 13
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createFromArray() 0 8 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shoman4eg\Nalog\Model\Tax;
5
6
use Shoman4eg\Nalog\Model\AbstractCollection;
7
use Shoman4eg\Nalog\Model\CreatableFromArray;
8
9
/**
10
 * @author Artem Dubinin <[email protected]>
11
 */
12
final class PaymentRecords extends AbstractCollection implements CreatableFromArray
13
{
14
    /**
15
     * @throws \Exception
16
     */
17
    public static function createFromArray(array $data): self
18
    {
19
        $items = array_map(static fn ($record) => Payment::createFromArray($record), $data['recors']);
20
21
        $model = new self();
22
        $model->setItems($items);
23
24
        return $model;
25
    }
26
}
27