| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | public static function processLiteral($sql, &$params) |
||
| 8 | { |
||
| 9 | if (!is_array($params)) { |
||
| 10 | return $sql; |
||
| 11 | } |
||
| 12 | |||
| 13 | foreach ($params as $field => $param) { |
||
| 14 | if ($param instanceof Literal) { |
||
| 15 | $literalValue = $param->getLiteralValue(); |
||
| 16 | $sql = preg_replace( |
||
| 17 | [ |
||
| 18 | "/\\[\\[$field\\]\\]/", |
||
| 19 | "/:$field([^\\d\\w]|$)/" |
||
| 20 | ], |
||
| 21 | [ |
||
| 22 | $literalValue, |
||
| 23 | "$literalValue\$1" |
||
| 24 | ], |
||
| 25 | $sql |
||
| 26 | ); |
||
| 27 | unset($params[$field]); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | return $sql; |
||
| 32 | } |
||
| 34 |