Completed
Push — master ( c5047e...3a177f )
by Gabriel
03:52
created

MorphMany   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 3
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A populateQuerySpecific() 0 7 1
1
<?php
2
3
namespace Nip\Records\Relations;
4
5
use Nip\Database\Query\AbstractQuery;
6
7
/**
8
 * Class MorphMany
9
 * @package Nip\Records\Relations
10
 */
11
class MorphMany extends MorphOneOrMany
12
{
13
14
    /**
15
     * @param AbstractQuery $query
16
     */
17 1
    public function populateQuerySpecific(AbstractQuery $query)
18
    {
19 1
        $query->where($this->getMorphTypeField() . ' = ?', $this->getMorphValue());
0 ignored issues
show
Documentation introduced by
$this->getMorphValue() is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
20
21 1
        $pk = $this->getManager()->getPrimaryKey();
22 1
        $query->where('`' . $this->getFK() . '` = ?', $this->getItem()->{$pk});
23 1
    }
24
}
25