Passed
Push — master ( c0f32c...e879f4 )
by Chema
04:17 queued 41s
created

Symbol   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
wmc 4
eloc 7
c 0
b 0
f 0
dl 0
loc 28
ccs 7
cts 9
cp 0.7778
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A fromString() 0 3 1
A __construct() 0 3 1
A empty() 0 3 1
A toString() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chemaclass\StockTicker\Domain\ReadModel;
6
7
/**
8
 * @psalm-immutable
9
 */
10
final class Symbol
11
{
12
    private string $symbol;
13
14
    /**
15
     * @psalm-pure
16
     */
17 8
    public static function fromString(string $symbol): self
18
    {
19 8
        return new self($symbol);
20
    }
21
22
    /**
23
     * @psalm-pure
24
     */
25
    public static function empty(): self
26
    {
27
        return new self('');
28
    }
29
30 8
    private function __construct(string $symbol)
31
    {
32 8
        $this->symbol = $symbol;
33 8
    }
34
35 8
    public function toString(): string
36
    {
37 8
        return $this->symbol;
38
    }
39
}
40