Test Failed
Pull Request — master (#7)
by Laurens
02:01
created

ImageParser::parseArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 10
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 View Code Duplication
final class ImageParser
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12 1
    public static function parseArray(array $images)
13
    {
14 1
        $collection = new ImageCollection();
15
16 1
        foreach ($images as $image) {
17 1
            $collection->add(self::parse($image));
18
        }
19
20 1
        return $collection;
21
    }
22
23 1
    private static function parse($data): Image
24
    {
25 1
        return new Image($data);
26
    }
27
}
28