Completed
Push — master ( 201ba3...2ef26d )
by Andrii
03:13
created

CustomerRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
ccs 0
cts 8
cp 0
rs 9.6666
cc 1
eloc 3
nc 1
nop 3
crap 2
1
<?php
2
/**
3
 * API for Billing
4
 *
5
 * @link      https://github.com/hiqdev/billing-hiapi
6
 * @package   billing-hiapi
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\billing\hiapi\customer;
12
13
use hiqdev\php\billing\customer\CustomerFactoryInterface;
14
use hiqdev\yii\DataMapper\components\ConnectionInterface;
15
16
class CustomerRepository extends \hiqdev\yii\DataMapper\repositories\BaseRepository
17
{
18
    /**
19
     * @var CustomerFactoryInterface
20
     */
21
    protected $factory;
22
23
    public function __construct(
24
        ConnectionInterface $db,
25
        CustomerFactoryInterface $factory,
26
        array $config = []
27
    ) {
28
        parent::__construct($config);
0 ignored issues
show
Bug introduced by
$config of type array is incompatible with the type hiqdev\yii\DataMapper\co...nts\ConnectionInterface expected by parameter $db of hiqdev\yii\DataMapper\re...pository::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

28
        parent::__construct(/** @scrutinizer ignore-type */ $config);
Loading history...
Bug introduced by
The call to hiqdev\yii\DataMapper\re...pository::__construct() has too few arguments starting with em. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        parent::/** @scrutinizer ignore-call */ 
29
                __construct($config);

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
29
30
        $this->db = $db;
31
        $this->factory = $factory;
32
    }
33
34
    public function create(array $row)
35
    {
36
        if (!empty($row['seller'])) {
37
            $row['seller'] = $this->create($row['seller']);
38
        }
39
40
        return parent::create($row);
41
    }
42
}
43