Passed
Push — master ( 903b32...e503ad )
by Manuel
06:03
created

StringModifier::stripWhitespace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Sprain\SwissQrBill\String;
4
5
class StringModifier
6
{
7
    public static function replaceLineBreaksWithString(?string $string): string
8
    {
9
        return str_replace(array("\r", "\n"), ' ', $string);
10
    }
11
12
    public static function replaceMultipleSpacesWithOne(?string $string): string
13
    {
14
        return preg_replace('/ +/', ' ', $string);
15
    }
16
17
    public static function stripWhitespace(?string $string): string
18
    {
19
        return preg_replace('/\s+/', '', $string);
20
    }
21
}
22