Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php defined('SYSPATH') OR die('No direct script access.'); |
||
13 | 3 | public static function update_counters($model, $ids, array $counters) |
|
14 | { |
||
15 | 3 | $query = Jam::update($model); |
|
16 | |||
17 | 3 | foreach ($counters as $name => $change) |
|
18 | { |
||
19 | 3 | $change = (int) $change; |
|
20 | 3 | $operator = $change < 0 ? '-' : '+'; |
|
21 | |||
22 | 3 | $query->value($name, DB::expr(strtr('(COALESCE(:name, 0) :operator :value)', array( |
|
23 | 3 | ':value' => abs($change), |
|
24 | 3 | ':operator' => $operator, |
|
25 | 3 | ':name' => Database::instance($query->meta()->db())->quote_column($name), |
|
|
|||
26 | )))); |
||
27 | } |
||
28 | |||
29 | 3 | return $query->where(':primary_key', 'IN', (array) $ids); |
|
30 | } |
||
31 | |||
42 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.