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

MarketModels   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 29
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
namespace Yandex\Market\Partner\Models;
4
5
use Yandex\Common\ObjectModel;
6
7
class MarketModels extends ObjectModel
8
{
9
    /**
10
     * Add model
11
     *
12
     * @param array|MarketModel $model
13
     * @return $this
14
     */
15
    public function add($model)
16
    {
17
        if (is_array($model)) {
18
            $this->collection[] = new MarketModel($model);
19
        } elseif ($model instanceof MarketModel) {
20
            $this->collection[] = $model;
21
        }
22
23
        return $this;
24
    }
25
26
    /**
27
     * Get models
28
     *
29
     * @return array
30
     */
31
    public function getAll()
32
    {
33
        return $this->collection;
34
    }
35
}
36