Completed
Push — master ( 17cd22...faaa31 )
by Andre
12s
created

PreNormalizedPart::normalize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
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
abstract class PreNormalizedPart extends AbstractPart
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