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

MarketModelOffers   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
dl 0
loc 29
ccs 5
cts 9
cp 0.5556
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 10 3
A getAll() 0 4 1
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