| Conditions | 4 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 59 | 12 | public static function bindParams($command, array $params) |
|
| 60 | { |
||
| 61 | 12 | $wrappers = array(); |
|
| 62 | 12 | $converters = array(); |
|
| 63 | 12 | foreach ($params as $key => $value) { |
|
| 64 | |||
| 65 | // Escaped |
||
| 66 | 9 | $wrappers[] = '{' . $key . '}'; |
|
| 67 | 9 | $converters[] = escapeshellarg(is_array($value) ? implode(' ', $value) : $value); |
|
| 68 | |||
| 69 | // Unescaped |
||
| 70 | 9 | $wrappers[] = '{!' . $key . '!}'; |
|
| 71 | 9 | $converters[] = is_array($value) ? implode(' ', $value) : $value; |
|
| 72 | 12 | } |
|
| 73 | |||
| 74 | 12 | return str_replace($wrappers, $converters, $command); |
|
| 75 | } |
||
| 76 | } |
||
| 77 |