Passed
Branch 2.0.0-dev (2fd06c)
by Jeroen
02:36
created

Telephone   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getFormatter() 0 3 1
A __toString() 0 3 1
A isAllowedMultipleTimes() 0 3 1
A getValue() 0 3 1
A getParser() 0 3 1
A getNode() 0 3 1
1
<?php
2
3
namespace JeroenDesloovere\VCard\Property;
4
5
use JeroenDesloovere\VCard\Formatter\Property\NodeFormatterInterface;
6
use JeroenDesloovere\VCard\Formatter\Property\LogoFormatter;
7
use JeroenDesloovere\VCard\Formatter\Property\TelephoneFormatter;
8
use JeroenDesloovere\VCard\Parser\Property\NodeParserInterface;
9
use JeroenDesloovere\VCard\Parser\Property\LogoParser;
10
use JeroenDesloovere\VCard\Parser\Property\TelephoneParser;
11
use JeroenDesloovere\VCard\Property\Value\ImageValue;
12
13
final class Telephone implements PropertyInterface, NodeInterface
14
{
15
    /** @var string */
16
    protected $value;
17
18
    public function __construct(string $value)
19
    {
20
        $this->value = str_replace(' ', '-', $value);
21
    }
22
23
    public function __toString(): string
24
    {
25
        return $this->value;
26
    }
27
28
    public function getFormatter(): NodeFormatterInterface
29
    {
30
        return new TelephoneFormatter($this);
31
    }
32
33
    public static function getNode(): string
34
    {
35
        return 'TEL';
36
    }
37
38
    public function getValue(): string
39
    {
40
        return $this->value;
41
    }
42
43
    public static function getParser(): NodeParserInterface
44
    {
45
        return new TelephoneParser();
46
    }
47
48
    public function isAllowedMultipleTimes(): bool
49
    {
50
        return false;
51
    }
52
}
53