Symbol::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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