Completed
Pull Request — master (#3)
by Andre
06:23
created

Suffix::normalize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace TheIconic\NameParser\Part;
4
5 View Code Duplication
class Suffix extends AbstractPart
0 ignored issues
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...
6
{
7
    protected $normalized = '';
8
9
    public function __construct(string $value, string $normalized = null)
10
    {
11
        $this->normalized = $normalized ?? $value;
12
13
        parent::__construct($value);
14
    }
15
16
    /**
17
     * if this is a lastname prefix, look up normalized version from registry
18
     * otherwise camelcase the lastname
19
     *
20
     * @return string
21
     */
22
    public function normalize(): string
23
    {
24
        return $this->normalized;
25
    }
26
}
27