Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
40 | 4 | public function initialize() |
|
41 | { |
||
42 | 4 | if (! $this->initialized) { |
|
43 | 4 | $query = $this->builder->toBase(); |
|
44 | 4 | $sql = $query->toSql(); |
|
45 | 4 | $bindings = $query->getBindings(); |
|
46 | 4 | $conn = $query->getConnection(); |
|
47 | 4 | $this->statement = $conn->getPdo()->prepare($sql); |
|
48 | 4 | $this->statement->execute($conn->prepareBindings($bindings)); |
|
49 | |||
50 | 4 | $this->prototype = $this->builder->getModel()->newFromBuilder(); |
|
|
|||
51 | 4 | } |
|
52 | |||
53 | 4 | $this->initialized = true; |
|
54 | 4 | } |
|
55 | |||
82 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: