Passed
Push — 1.0.0 ( b8a5a2...41296f )
by Alex
01:35
created

PhoneNumber   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 26
rs 10
ccs 12
cts 12
cp 1
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A number() 0 3 1
A __construct() 0 4 1
A prefix() 0 3 1
A create() 0 5 1
1
<?php
2
3
namespace StraTDeS\VO;
4
5
class PhoneNumber
6
{
7
    private string $prefix;
8
    private string $number;
9
10 1
    private function __construct(string $prefix, string $number)
11
    {
12 1
        $this->prefix = $prefix;
13 1
        $this->number = $number;
14 1
    }
15
16 1
    public static function create(string $prefix, string $number): PhoneNumber
17
    {
18 1
        $prefix = str_replace([' ', '+'], '', $prefix);
19 1
        $number = str_replace(' ', '', $number);
20 1
        return new self($prefix, $number);
21
    }
22
23 1
    public function prefix(): string
24
    {
25 1
        return $this->prefix;
26
    }
27
28 1
    public function number(): string
29
    {
30 1
        return $this->number;
31
    }
32
}
33