Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
7497 | public static function str_replace_last( |
||
7498 | string $search, |
||
7499 | string $replace, |
||
7500 | string $subject |
||
7501 | ): string { |
||
7502 | 2 | $pos = self::strrpos($subject, $search); |
|
7503 | 2 | if ($pos !== false) { |
|
7504 | /** |
||
7505 | * @psalm-suppress InvalidReturnStatement |
||
7506 | */ |
||
7507 | 2 | return self::substr_replace( |
|
7508 | 2 | $subject, |
|
7509 | 2 | $replace, |
|
7510 | 2 | $pos, |
|
7511 | 2 | (int) self::strlen($search) |
|
7512 | ); |
||
7513 | } |
||
7514 | |||
7515 | 2 | return $subject; |
|
7516 | } |
||
13723 |