Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
6 / 6 |
MongoJsParserReplacer | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
6 | |
100.00% |
6 / 6 |
handle | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
r | |
100.00% |
1 / 1 |
3 | |
100.00% |
3 / 3 |
|||
pr | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
prc | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
1 | <?php |
2 | |
3 | namespace Qmp\Laravel\MongoJsExecutor\Replacers; |
4 | |
5 | use Qmp\Laravel\MongoJsExecutor\Exceptions\HandleMethodNotOverloaded; |
6 | |
7 | class MongoJsParserReplacer |
8 | { |
9 | /**s |
10 | * Undocumented function |
11 | * |
12 | * @return void |
13 | */ |
14 | public function handle($json) |
15 | { |
16 | throw new HandleMethodNotOverloaded(); |
17 | } |
18 | |
19 | /** |
20 | * Undocumented function |
21 | * |
22 | * @param array|string $search |
23 | * @param array|string $replace |
24 | * @param string $subject |
25 | * @return string |
26 | */ |
27 | protected function r($search, $replace, $subject = null) |
28 | { |
29 | if ($subject === null && is_array($search)) { |
30 | return str_replace(array_keys($search), array_values($search), $replace); |
31 | } |
32 | return str_replace($search, $replace, $subject); |
33 | } |
34 | |
35 | /** |
36 | * Undocumented function |
37 | * |
38 | * @param array|string $search |
39 | * @param array|string $replace |
40 | * @param string $subject |
41 | * @return array|string|null |
42 | */ |
43 | protected function pr($search, $replace, $subject) |
44 | { |
45 | return preg_replace($search, $replace, $subject); |
46 | } |
47 | |
48 | /** |
49 | * Undocumented function |
50 | * |
51 | * @param array|string $search |
52 | * @param callable $replace |
53 | * @param string $subject |
54 | * @return array|string|null |
55 | */ |
56 | protected function prc($search, $callback, $subject) |
57 | { |
58 | return preg_replace_callback($search, $callback, $subject); |
59 | } |
60 | } |