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

MarketModels   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 MarketModels extends ObjectModel
14
{
15
    /**
16
     * Add model
17
     *
18
     * @param array|MarketModel $model
19
     * @return $this
20
     */
21 5
    public function add($model)
22
    {
23 5
        if (is_array($model)) {
24 5
            $this->collection[] = new MarketModel($model);
25 5
        } elseif ($model instanceof MarketModel) {
26
            $this->collection[] = $model;
27
        }
28
29 5
        return $this;
30
    }
31
32
    /**
33
     * Get models
34
     *
35
     * @return array
36
     */
37
    public function getAll()
38
    {
39
        return $this->collection;
40
    }
41
}
42