Symbol   A
last analyzed

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 toString() 0 3 1
A fromString() 0 3 1
A __construct() 0 3 1
A empty() 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
    private function __construct(string $symbol)
15
    {
16
        $this->symbol = $symbol;
17 7
    }
18
19 7
    /**
20
     * @psalm-pure
21
     */
22
    public static function fromString(string $symbol): self
23
    {
24
        return new self($symbol);
25
    }
26
27
    /**
28
     * @psalm-pure
29
     */
30 7
    public static function empty(): self
31
    {
32 7
        return new self('');
33 7
    }
34
35 7
    public function toString(): string
36
    {
37 7
        return $this->symbol;
38
    }
39
}
40