| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2.0116 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 3 | protected static function replaceOnce(string $search, string $replace, string $subject): string |
|
| 25 | { |
||
| 26 | 3 | $firstChar = strpos($subject, $search); |
|
| 27 | 3 | if (false !== $firstChar) { |
|
| 28 | 3 | $beforeStr = substr($subject, 0, $firstChar); |
|
| 29 | 3 | $afterStr = substr($subject, $firstChar + strlen($search)); |
|
| 30 | |||
| 31 | 3 | return $beforeStr.$replace.$afterStr; |
|
| 32 | } else { |
||
| 33 | return $subject; |
||
| 34 | } |
||
| 42 |