Passed
Branch new-version (77ae24)
by Jeroen
02:34
created

PropertyParser::convertEmptyStringToNull()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 3
nc 3
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace JeroenDesloovere\VCard\Parser\Property;
4
5
class PropertyParser
6
{
7
    protected function convertEmptyStringToNull(array $values): void
8
    {
9
        foreach ($values as &$value) {
10
            if ($value === '') {
11
                $value = null;
12
            }
13
        }
14
    }
15
16
    /**
17
     * Unescape newline characters according to RFC2425 section 5.8.4.
18
     * This function will replace escaped line breaks with PHP_EOL.
19
     *
20
     * @link http://tools.ietf.org/html/rfc2425#section-5.8.4
21
     * @param  string $text
22
     * @return string
23
     */
24
    protected function unescape($text): string
25
    {
26
        return str_replace("\\n", PHP_EOL, $text);
27
    }
28
}
29