Completed
Pull Request — master (#11)
by Laurens
02:39 queued 51s
created

ImageBuilder::buildFromArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LauLamanApps\IzettleApi\Client\Universal;
6
7
use LauLamanApps\IzettleApi\API\Image;
8
use LauLamanApps\IzettleApi\API\ImageCollection;
9
10
final class ImageBuilder implements ImageBuilderInterface
11
{
12 4
    public function buildFromArray(array $images)
13
    {
14 4
        $collection = new ImageCollection();
15
16 4
        foreach ($images as $image) {
17 3
            $collection->add($this->build($image));
18
        }
19
20 4
        return $collection;
21
    }
22
23 3
    private function build($data): Image
24
    {
25 3
        return new Image($data);
26
    }
27
}
28