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

MarketModels::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 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