Completed
Push — master ( 0da056...260312 )
by Aleksander
05:02
created

DeliveryRules::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 4
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Yandex\Market\Partner\Models;
4
5
use Yandex\Common\ObjectModel;
6
7 View Code Duplication
class DeliveryRules extends ObjectModel
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
10
    protected $collection = [];
11
12
    protected $mappingClasses = [];
13
14
    protected $propNameMap = [];
15
16
    /**
17
     * Add item
18
     */
19 2
    public function add($deliveryRule)
20
    {
21 2
        if (is_array($deliveryRule)) {
22 2
            $this->collection[] = new DeliveryRule($deliveryRule);
23 2
        } elseif (is_object($deliveryRule) && $deliveryRule instanceof DeliveryRule) {
24
            $this->collection[] = $deliveryRule;
25
        }
26
27 2
        return $this;
28
    }
29
30
    /**
31
     * Get items
32
     */
33 1
    public function getAll()
34
    {
35 1
        return $this->collection;
36
    }
37
}
38