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