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