Conditions | 4 |
Paths | 5 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4.016 |
Changes | 0 |
1 | <?php |
||
63 | 2 | public function handleQuery(Query $query, callable $next, callable $first) |
|
64 | { |
||
65 | 2 | if (!$query instanceof GeocodeQuery) { |
|
66 | return $next($query); |
||
67 | } |
||
68 | |||
69 | 2 | $replacement = $this->replacement; |
|
70 | |||
71 | 2 | if (null !== $this->faker) { |
|
72 | 1 | $replacement = $this->faker->ipv4; |
|
73 | } |
||
74 | |||
75 | 2 | $text = str_replace($this->needle, $replacement, $query->getText(), $count); |
|
76 | 2 | if ($count > 0) { |
|
77 | 2 | $query = $query->withText($text); |
|
78 | } |
||
79 | |||
80 | 2 | return $next($query); |
|
81 | } |
||
82 | } |
||
83 |