Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2.0185 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7479 | 2 | public static function str_replace_first( |
|
7480 | string $search, |
||
7481 | string $replace, |
||
7482 | string $subject |
||
7483 | ): string { |
||
7484 | 2 | $pos = self::strpos($subject, $search); |
|
7485 | |||
7486 | 2 | if ($pos !== false) { |
|
7487 | /** |
||
7488 | * @psalm-suppress InvalidReturnStatement |
||
7489 | */ |
||
7490 | 2 | return self::substr_replace( |
|
7491 | $subject, |
||
7492 | $replace, |
||
7493 | $pos, |
||
7494 | 2 | (int) self::strlen($search) |
|
7495 | ); |
||
7496 | } |
||
7497 | |||
7498 | return $subject; |
||
7499 | } |
||
13722 |