Completed
Pull Request — master (#179)
by
unknown
05:10
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
namespace Yandex\Market\Partner\Models;
4
5
use Yandex\Common\ObjectModel;
6
7
class MarketModelOffers extends ObjectModel
8
{
9
    /**
10
     * Add model offer
11
     *
12
     * @param array|MarketModelOffer $offer
13
     * @return MarketModelOffers
14
     */
15 2
    public function add($offer)
16
    {
17 2
        if (is_array($offer)) {
18 2
            $this->collection[] = new MarketModelOffer($offer);
19 2
        } elseif ($offer instanceof MarketModelOffer) {
20
            $this->collection[] = $offer;
21
        }
22
23 2
        return $this;
24
    }
25
26
    /**
27
     * Get all model offers
28
     *
29
     * @return array
30
     */
31
    public function getAll()
32
    {
33
        return $this->collection;
34
    }
35
}
36