Passed
Branch new-version (84e8bd)
by Jeroen
03:20
created

FullName   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
dl 35
loc 35
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 3 3 1
A getParser() 3 3 1
A isAllowedMultipleTimes() 3 3 1
A getFormatter() 3 3 1
A getNode() 3 3 1
A __toString() 3 3 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace JeroenDesloovere\VCard\Property;
4
5
use JeroenDesloovere\VCard\Formatter\Property\FullNameFormatter;
6
use JeroenDesloovere\VCard\Formatter\Property\NodeFormatterInterface;
7
use JeroenDesloovere\VCard\Parser\Property\FullNameParser;
8
use JeroenDesloovere\VCard\Parser\Property\NodeParserInterface;
9
10 View Code Duplication
final class FullName implements PropertyInterface, SimpleNodeInterface
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    /**
13
     * @var string
14
     */
15
    private $value;
16
17
    public function __construct(string $value)
18
    {
19
        $this->value = $value;
20
    }
21
22
    public function __toString(): string
23
    {
24
        return $this->value;
25
    }
26
27
    public function getFormatter(): NodeFormatterInterface
28
    {
29
        return new FullNameFormatter($this);
30
    }
31
32
    public static function getNode(): string
33
    {
34
        return 'FN';
35
    }
36
37
    public static function getParser(): NodeParserInterface
38
    {
39
        return new FullNameParser();
40
    }
41
42
    public function isAllowedMultipleTimes(): bool
43
    {
44
        return false;
45
    }
46
}
47