Completed
Push — master ( 44dfcb...96c0b2 )
by Anton
9s
created

Accounts::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 1
Ratio 25 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 1
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Yandex\Metrica\Management\Models;
4
5
use Yandex\Common\ObjectModel;
6
7 View Code Duplication
class Accounts 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
     * @param Account $account
19
     *
20
     * @return $this
21
     */
22 6
    public function add($account)
23
    {
24 6
        if (is_array($account)) {
25 6
            $this->collection[] = new Account($account);
26 6
        } elseif (is_object($account) && $account instanceof Account) {
27 1
            $this->collection[] = $account;
28 1
        }
29
30 6
        return $this;
31
    }
32
33
    /**
34
     * Get items
35
     * @return Account[]
36
     */
37 1
    public function getAll()
38
    {
39 1
        return $this->collection;
40
    }
41
}
42