Passed
Branch new-version (5a237d)
by Jeroen
02:27
created

AddressFormatter::convertToVcfString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A AddressFormatter::__construct() 0 3 1
1
<?php
2
3
namespace JeroenDesloovere\VCard\Formatter\Property;
4
5
use JeroenDesloovere\VCard\Property\Address;
6
use JeroenDesloovere\VCard\Property\PropertyInterface;
7
8
class AddressFormatter extends PropertyFormatter implements PropertyFormatterInterface
9
{
10
    /**
11
     * @var Address
12
     */
13
    protected $address;
14
15
    public function __construct(Address $address)
16
    {
17
        $this->address = $address;
18
    }
19
20
    public function getVcfString(): string
21
    {
22
        return $this->address->getNode() . ':' . $this->escape(
23
            $this->address->getPostOfficeBox()
24
            . ';' . $this->address->getExtendedAddress()
25
            . ';' . $this->address->getStreetAddress()
26
            . ';' . $this->address->getLocality()
27
            . ';' . $this->address->getRegion()
28
            . ';' . $this->address->getPostalCode()
29
            . ';' . $this->address->getCountryName()
30
        );
31
    }
32
}
33