PaymentTypeCollection::createFromArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Shoman4eg\Nalog\Model\PaymentType;
5
6
use Shoman4eg\Nalog\Model\AbstractCollection;
7
use Shoman4eg\Nalog\Model\CreatableFromArray;
8
9
/**
10
 * @author Artem Dubinin <[email protected]>
11
 *
12
 * @extends AbstractCollection<PaymentType>
13
 */
14
final class PaymentTypeCollection extends AbstractCollection implements CreatableFromArray
15
{
16
    private function __construct() {}
17
18
    public static function createFromArray(array $data): self
19
    {
20
        $items = array_map(static fn (array $item) => PaymentType::createFromArray($item), $data['items']);
21
22
        $model = new self();
23
        $model->setItems($items);
24
25
        return $model;
26
    }
27
}
28