| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 38 | public function buildCondition($key, $value) |
||
| 39 | { |
||
| 40 | $params = []; |
||
| 41 | if ($value['client_id']) { |
||
| 42 | $params[':available_for_client_id'] = $value['client_id']; |
||
| 43 | $ids_sql = ' |
||
| 44 | SELECT tariff_id |
||
| 45 | FROM client2tariff |
||
| 46 | WHERE client_id=:available_for_client_id |
||
| 47 | '; |
||
| 48 | } else { |
||
| 49 | $params[':available_for_seller'] = $value['seller']; |
||
| 50 | $ids_sql = " |
||
| 51 | SELECT dst_id |
||
| 52 | FROM tie |
||
| 53 | WHERE src_id=client_id(:available_for_seller) |
||
| 54 | AND tag_id=type_id('tariff') |
||
| 55 | "; |
||
| 56 | } |
||
| 57 | |||
| 58 | return new Expression("zt.obj_id IN ($ids_sql)", $params); |
||
|
|
|||
| 59 | } |
||
| 61 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: