Conditions | 3 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
46 | 1 | protected function deleteByTypeQuery($emailsManager, $type, $days) |
|
47 | { |
||
48 | 1 | $query = $emailsManager->newDeleteQuery(); |
|
|
|||
49 | 1 | if (is_string($type) && strlen($type) > 1) { |
|
50 | 1 | $query->where('`type` = ?', $type); |
|
51 | } |
||
52 | 1 | $query->where( |
|
53 | 1 | '`' . $emailsManager::getSentDateField() . '` <= DATE_SUB(CURRENT_DATE(), INTERVAL ' . $days . ' DAY)' |
|
54 | ); |
||
55 | |||
56 | 1 | return $query; |
|
57 | } |
||
58 | } |
||
59 |
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: