| Total Complexity | 3 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Coverage | 88.89% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class Utility { |
||
| 16 | /** |
||
| 17 | * Parses a query containing parameters into an array, and can replace them with a predefined replacement (can be a callable). |
||
| 18 | * The callable is used to return numbered parameters (such as used in PostgreSQL), or any other kind of parameters supported by the DBMS. |
||
| 19 | * @param string $query |
||
| 20 | * @param string|callable|null $replaceParams If `null` is passed, it will not replace the parameters. |
||
| 21 | * @param string $regex |
||
| 22 | * @return array `[ 'query' => string, 'parameters' => array ]` The `parameters` array is an numeric array (= position, starting at 1), which map to the original parameter. |
||
| 23 | */ |
||
| 24 | 2 | static function parseParameters(string $query, $replaceParams = '?', string $regex = '/(:[a-z]+)|\?|\$\d+/i'): array { |
|
| 41 |