Completed
Push — master ( 201238...507368 )
by Aleksander
05:51
created

MarketModelOffers::add()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3.2098

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 1
dl 0
loc 10
ccs 5
cts 7
cp 0.7143
crap 3.2098
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Yandex PHP Library
4
 *
5
 * @copyright NIX Solutions Ltd.
6
 * @link https://github.com/nixsolutions/yandex-php-library
7
 */
8
9
namespace Yandex\Market\Partner\Models;
10
11
use Yandex\Common\ObjectModel;
12
13
class MarketModelOffers extends ObjectModel
14
{
15
    /**
16
     * Add model offer
17
     *
18
     * @param array|MarketModelOffer $offer
19
     * @return MarketModelOffers
20
     */
21 2
    public function add($offer)
22
    {
23 2
        if (is_array($offer)) {
24 2
            $this->collection[] = new MarketModelOffer($offer);
25 2
        } elseif ($offer instanceof MarketModelOffer) {
26
            $this->collection[] = $offer;
27
        }
28
29 2
        return $this;
30
    }
31
32
    /**
33
     * Get all model offers
34
     *
35
     * @return array
36
     */
37
    public function getAll()
38
    {
39
        return $this->collection;
40
    }
41
}
42