Completed
Pull Request — master (#179)
by
unknown
08:15
created

MarketModelOffers::add()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 1
dl 0
loc 10
rs 9.4285
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
    public function add($offer)
16
    {
17
        if (is_array($offer)) {
18
            $this->collection[] = new MarketModelOffer($offer);
19
        } elseif ($offer instanceof MarketModelOffer) {
20
            $this->collection[] = $offer;
21
        }
22
23
        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