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

PreNormalizedPart   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A normalize() 0 4 1
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