|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Chemaclass\StockTicker\Domain\WriteModel; |
|
6
|
|
|
|
|
7
|
|
|
final class Trend extends AbstractWriteModel |
|
8
|
|
|
{ |
|
9
|
|
|
public const PERIOD = 'period'; |
|
10
|
|
|
public const STRONG_BUY = 'strongBuy'; |
|
11
|
|
|
public const BUY = 'buy'; |
|
12
|
|
|
public const HOLD = 'hold'; |
|
13
|
|
|
public const SELL = 'sell'; |
|
14
|
|
|
public const STRONG_SELL = 'strongSell'; |
|
15
|
|
|
|
|
16
|
|
|
protected const PROPERTY_NAME_MAP = [ |
|
17
|
|
|
'period' => self::PERIOD, |
|
18
|
|
|
'Period' => self::PERIOD, |
|
19
|
|
|
'strong_buy' => self::STRONG_BUY, |
|
20
|
|
|
'strongBuy' => self::STRONG_BUY, |
|
21
|
|
|
'StrongBuy' => self::STRONG_BUY, |
|
22
|
|
|
'buy' => self::BUY, |
|
23
|
|
|
'Buy' => self::BUY, |
|
24
|
|
|
'hold' => self::HOLD, |
|
25
|
|
|
'Hold' => self::HOLD, |
|
26
|
|
|
'sell' => self::SELL, |
|
27
|
|
|
'Sell' => self::SELL, |
|
28
|
|
|
'strong_sell' => self::STRONG_SELL, |
|
29
|
|
|
'strongSell' => self::STRONG_SELL, |
|
30
|
|
|
'StrongSell' => self::STRONG_SELL, |
|
31
|
|
|
]; |
|
32
|
|
|
|
|
33
|
|
|
private const METADATA = [ |
|
34
|
|
|
self::PERIOD => [ |
|
35
|
|
|
'type' => self::TYPE_STRING, |
|
36
|
|
|
], |
|
37
|
|
|
self::STRONG_BUY => [ |
|
38
|
|
|
'type' => self::TYPE_INT, |
|
39
|
|
|
], |
|
40
|
|
|
self::BUY => [ |
|
41
|
|
|
'type' => self::TYPE_INT, |
|
42
|
|
|
], |
|
43
|
|
|
self::HOLD => [ |
|
44
|
|
|
'type' => self::TYPE_INT, |
|
45
|
|
|
], |
|
46
|
|
|
self::SELL => [ |
|
47
|
|
|
'type' => self::TYPE_INT, |
|
48
|
|
|
], |
|
49
|
|
|
self::STRONG_SELL => [ |
|
50
|
|
|
'type' => self::TYPE_INT, |
|
51
|
|
|
], |
|
52
|
|
|
]; |
|
53
|
|
|
|
|
54
|
|
|
protected ?string $period = null; |
|
55
|
|
|
protected ?int $strongBuy = null; |
|
56
|
|
|
protected ?int $buy = null; |
|
57
|
|
|
protected ?int $hold = null; |
|
58
|
|
|
protected ?int $sell = null; |
|
59
|
|
|
protected ?int $strongSell = null; |
|
60
|
|
|
|
|
61
|
1 |
|
public function getPeriod(): ?string |
|
62
|
|
|
{ |
|
63
|
1 |
|
return $this->period; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
1 |
|
public function setPeriod(string $period): self |
|
67
|
|
|
{ |
|
68
|
1 |
|
$this->period = $period; |
|
69
|
|
|
|
|
70
|
1 |
|
return $this; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
1 |
|
public function getStrongBuy(): ?int |
|
74
|
|
|
{ |
|
75
|
1 |
|
return $this->strongBuy; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
1 |
|
public function setStrongBuy(int $strongBuy): self |
|
79
|
|
|
{ |
|
80
|
1 |
|
$this->strongBuy = $strongBuy; |
|
81
|
|
|
|
|
82
|
1 |
|
return $this; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
1 |
|
public function getBuy(): ?int |
|
86
|
|
|
{ |
|
87
|
1 |
|
return $this->buy; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
1 |
|
public function setBuy(int $buy): self |
|
91
|
|
|
{ |
|
92
|
1 |
|
$this->buy = $buy; |
|
93
|
|
|
|
|
94
|
1 |
|
return $this; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
1 |
|
public function getHold(): ?int |
|
98
|
|
|
{ |
|
99
|
1 |
|
return $this->hold; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
1 |
|
public function setHold(int $hold): self |
|
103
|
|
|
{ |
|
104
|
1 |
|
$this->hold = $hold; |
|
105
|
|
|
|
|
106
|
1 |
|
return $this; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
1 |
|
public function getSell(): ?int |
|
110
|
|
|
{ |
|
111
|
1 |
|
return $this->sell; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
1 |
|
public function setSell(int $sell): self |
|
115
|
|
|
{ |
|
116
|
1 |
|
$this->sell = $sell; |
|
117
|
|
|
|
|
118
|
1 |
|
return $this; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
1 |
|
public function getStrongSell(): ?int |
|
122
|
|
|
{ |
|
123
|
1 |
|
return $this->strongSell; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
1 |
|
public function setStrongSell(int $strongSell): self |
|
127
|
|
|
{ |
|
128
|
1 |
|
$this->strongSell = $strongSell; |
|
129
|
|
|
|
|
130
|
1 |
|
return $this; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
13 |
|
protected function metadata(): array |
|
134
|
|
|
{ |
|
135
|
13 |
|
return self::METADATA; |
|
136
|
|
|
} |
|
137
|
|
|
} |
|
138
|
|
|
|