Completed
Push — master ( 0eceaa...aee3a6 )
by Ben
15:21 queued 05:47
created

Locale   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 6
lcom 0
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A from() 0 4 1
A get() 0 4 1
A equals() 0 4 2
A __toString() 0 4 1
1
<?php
2
3
namespace Thinktomorrow\Locale\Values;
4
5
final class Locale
6
{
7
    /**
8
     * @var string Locale key identifier
9
     */
10
    private $value;
11
12 78
    private function __construct(string $value)
13
    {
14 78
        $this->value = $value;
15 78
    }
16
17 78
    public static function from(string $value)
18
    {
19 78
        return new static($value);
20
    }
21
22 66
    public function get(): string
23
    {
24 66
        return $this->value;
25
    }
26
27 1
    public function equals(self $other): bool
28
    {
29 1
        return get_class($this) === get_class($other) && (string) $this === (string) $other;
30
    }
31
32 66
    public function __toString(): string
33
    {
34 66
        return $this->get();
35
    }
36
}
37