SkyoPriceClient::addMetaToPrices()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 7
cts 7
cp 1
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
crap 2
1
<?php namespace Packback\Prices\Clients;
2
3
class SkyoPriceClient extends CommissionJunctionPriceClient
4
{
5
    const RETAILER = 'skyo';
6
7 2
    public function __construct($config = [])
8
    {
9 2
        $cj_config = array_merge($config['cj'], $config[self::RETAILER]);
10 2
        parent::__construct($cj_config);
11 2
    }
12
13 2
    public function getPricesForIsbns($isbns = [])
14
    {
15 2
        foreach ($isbns as $isbn) {
16 2
            $response = $this->addParam('isbn', $isbn)->send();
17 2
            $this->addPricesToCollection($response);
18 2
        }
19 2
        $this->addMetaToPrices($this->collection);
20 2
        return $this->collection;
21
    }
22
23 2
    private function addMetaToPrices($prices = [])
24
    {
25 2
        foreach ($prices as $i => $price) {
26 2
            $prices[$i]->retailer = self::RETAILER;
27 2
            $prices[$i]->condition = parent::CONDITION_NEW;
28 2
            $prices[$i]->term = parent::TERM_SEMESTER;
29 2
        }
30 2
        return $prices;
31
    }
32
}
33