Conditions | 3 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3.0123 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
4997 | 18 | public static function regex_replace( |
|
4998 | string $str, |
||
4999 | string $pattern, |
||
5000 | string $replacement, |
||
5001 | string $options = '', |
||
5002 | string $delimiter = '/' |
||
5003 | ): string { |
||
5004 | 18 | if ($options === 'msr') { |
|
5005 | 9 | $options = 'ms'; |
|
5006 | } |
||
5007 | |||
5008 | // fallback |
||
5009 | 18 | if (!$delimiter) { |
|
5010 | $delimiter = '/'; |
||
5011 | } |
||
5012 | |||
5013 | 18 | return (string) \preg_replace( |
|
5014 | 18 | $delimiter . $pattern . $delimiter . 'u' . $options, |
|
5015 | 18 | $replacement, |
|
5016 | 18 | $str |
|
5017 | ); |
||
13694 |