Completed
Pull Request — new-version (#111)
by Tom
02:24
created

GenderFormatter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getVcfString() 0 10 2
A __construct() 0 3 1
1
<?php
2
3
namespace JeroenDesloovere\VCard\Formatter\Property;
4
5
use JeroenDesloovere\VCard\Property\Gender;
6
7
final class GenderFormatter extends NodeFormatter implements NodeFormatterInterface
8
{
9
    /**
10
     * @var Gender
11
     */
12
    protected $gender;
13
14
    public function __construct(Gender $gender)
15
    {
16
        $this->gender = $gender;
17
    }
18
19
    public function getVcfString(): string
20
    {
21
        $string = Gender::getNode();
22
        $string .= ':' . $this->gender->getGender()->__toString();
23
24
        if ($this->gender->getNote() !== null) {
25
            $string .= ';' . $this->escape($this->gender->getNote());
26
        }
27
28
        return $string;
29
    }
30
}
31