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

MarketModelOffers::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
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