Completed
Push — master ( ab94e9...fa2f9e )
by Gabriel
02:21
created

OptionsMapper::map()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 3
cts 4
cp 0.75
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 2
crap 2.0625
1
<?php
2
3
namespace Waredesk\Mappers\Product\Variant;
4
5
use Waredesk\Collections\Products\Variants\Options;
6
use Waredesk\Models\Product\Variant\Option;
7
8
class OptionsMapper
9
{
10 1
    public function map(Options $options, array $data): Options
11
    {
12 1
        foreach ($data as $optionData) {
13
            $options->add((new OptionMapper())->map(new Option(), $optionData));
14
        }
15 1
        return $options;
16
    }
17
}
18