Completed
Pull Request — master (#9)
by Laurens
01:58
created

ImageBuilder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 23
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A buildFromJson() 0 4 1
A buildFromArray() 0 10 2
A build() 0 4 1
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
    public function buildFromJson(string $json): Image
13
    {
14
        // TODO: Implement buildFromJson() method.
15
    }
16
17 4
    public function buildFromArray(array $images): ImageCollection
18
    {
19 4
        $collection = new ImageCollection();
20
21 4
        foreach ($images as $image) {
22 3
            $collection->add($this->build($image));
23
        }
24
25 4
        return $collection;
26
    }
27
28 3
    private function build($data): Image
29
    {
30 3
        return new Image($data);
31
    }
32
}
33