Passed
Branch 2.0.0-dev (fd104f)
by Jeroen
04:04
created

NameParser   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A parseVcfString() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JeroenDesloovere\VCard\Parser\Property;
6
7
use JeroenDesloovere\VCard\Property\Name;
8
use JeroenDesloovere\VCard\Property\NodeInterface;
9
10
final class NameParser extends PropertyParser implements NodeParserInterface
11
{
12
    public function parseVcfString(string $value, array $parameters = []): NodeInterface
13
    {
14
        @list($firstName, $additional, $lastName, $prefix, $suffix) = explode(';', $value);
15
16
        $this->convertEmptyStringToNull([
17
            $lastName,
18
            $firstName,
19
            $additional,
20
            $prefix,
21
            $suffix
22
        ]);
23
24
        return new Name($lastName, $firstName, $additional, $prefix, $suffix);
25
    }
26
}
27