| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 79 | 2 | public function replace($search, $replace, $regexp = false) |
|
| 80 | {
|
||
| 81 | if( $regexp ) |
||
| 82 | 2 | {
|
|
| 83 | 2 | if( is_callable($replace) ) |
|
| 84 | 2 | {
|
|
| 85 | 1 | $this->string = preg_replace_callback($search, $replace, $this->string); |
|
| 86 | 1 | } |
|
| 87 | else |
||
| 88 | {
|
||
| 89 | 2 | $this->string = preg_replace($search, $replace, $this->string); |
|
| 90 | } |
||
| 91 | 2 | } |
|
| 92 | else |
||
| 93 | {
|
||
| 94 | 2 | $this->string = str_replace($search, $replace, $this->string); |
|
| 95 | } |
||
| 96 | |||
| 97 | 2 | return $this; |
|
| 98 | } |
||
| 99 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: