Completed
Pull Request — master (#139)
by
unknown
04:18
created

ResponseModelGet   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 1
Metric Value
wmc 4
c 3
b 1
f 1
lcom 0
cbo 2
dl 0
loc 34
ccs 11
cts 11
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 3
A getModel() 0 4 1
1
<?php
2
3
namespace Yandex\Market\Content\Models;
4
5
use Yandex\Common\Model;
6
use Yandex\Market\Content\Models\Base\MarketModel;
7
8
class ResponseModelGet extends Model
9
{
10
    protected $model = null;
11
12
    protected $mappingClasses = [
13
        'model' => 'Yandex\Market\Content\Models\Base\MarketModel'
14
    ];
15
16
    /**
17
     * Constructor
18
     *
19
     * @param array $data
20
     */
21 1
    public function __construct($data = array())
22
    {
23 1
        foreach ($this->mappingClasses as $propName => &$mappingClassName) {
24 1
            if ($mappingClassName == 'Yandex\Market\Content\Models\Base\MarketModel') {
25 1
                $realMappingClassName = MarketModel::getInstanceClassName($data[$propName]);
26 1
                $mappingClassName = $realMappingClassName;
27 1
            }
28 1
        }
29 1
        parent::__construct($data);
30 1
    }
31
32
    /**
33
     * Retrieve the model property
34
     *
35
     * @return ProductModel|null
36
     */
37 1
    public function getModel()
38
    {
39 1
        return $this->model;
40
    }
41
}
42