1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Mokka\Action; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
class Action |
7
|
|
|
{ |
8
|
|
|
|
9
|
|
|
/** @var double */ |
10
|
|
|
protected $actionPrice; |
11
|
|
|
|
12
|
|
|
/** @var double */ |
13
|
|
|
protected $previousPrice; |
14
|
|
|
|
15
|
|
|
protected $type; |
16
|
|
|
|
17
|
|
|
protected $symbol; |
18
|
|
|
|
19
|
|
|
protected $market; |
20
|
|
|
|
21
|
|
|
protected $lastUpdate; |
22
|
|
|
|
23
|
|
|
public function __construct($array = null) |
24
|
|
|
{ |
25
|
|
|
$this->fromArray($array); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @return mixed |
30
|
|
|
*/ |
31
|
|
|
public function getType() |
32
|
|
|
{ |
33
|
|
|
return $this->type; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param mixed $type |
38
|
|
|
*/ |
39
|
|
|
public function setType($type) |
40
|
|
|
{ |
41
|
|
|
$this->type = $type; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return mixed |
46
|
|
|
*/ |
47
|
|
|
public function getPreviousPrice() |
48
|
|
|
{ |
49
|
|
|
return $this->previousPrice; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param mixed $price |
54
|
|
|
*/ |
55
|
|
|
public function setPreviousPrice($price) |
56
|
|
|
{ |
57
|
|
|
$this->previousPrice = $price; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return mixed |
62
|
|
|
*/ |
63
|
|
|
public function getSymbol() |
64
|
|
|
{ |
65
|
|
|
return $this->symbol; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param mixed $symbol |
70
|
|
|
*/ |
71
|
|
|
public function setSymbol($symbol) |
72
|
|
|
{ |
73
|
|
|
$this->symbol = $symbol; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return mixed |
78
|
|
|
*/ |
79
|
|
|
public function getMarket() |
80
|
|
|
{ |
81
|
|
|
return $this->market; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param mixed $market |
86
|
|
|
*/ |
87
|
|
|
public function setMarket($market) |
88
|
|
|
{ |
89
|
|
|
$this->market = $market; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return mixed |
94
|
|
|
*/ |
95
|
|
|
public function getLastUpdate() |
96
|
|
|
{ |
97
|
|
|
return $this->lastUpdate; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @param mixed $lastUpdate |
102
|
|
|
*/ |
103
|
|
|
public function setLastUpdate($lastUpdate) |
104
|
|
|
{ |
105
|
|
|
$this->lastUpdate = $lastUpdate; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @return mixed |
110
|
|
|
*/ |
111
|
|
|
public function getActionPrice() |
112
|
|
|
{ |
113
|
|
|
return $this->actionPrice; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @param mixed $actionPrice |
118
|
|
|
*/ |
119
|
|
|
public function setActionPrice($actionPrice) |
120
|
|
|
{ |
121
|
|
|
$this->actionPrice = $actionPrice; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
|
125
|
|
|
private function fromArray($array) |
126
|
|
|
{ |
127
|
|
|
if (!is_null($array)) { |
128
|
|
|
foreach ($array as $key => $item) { |
129
|
|
|
if (property_exists(Action::class, $key)) { |
130
|
|
|
$method = 'set'.ucfirst($key); |
131
|
|
|
$this->$method($item); |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function toArray() |
138
|
|
|
{ |
139
|
|
|
return get_object_vars($this); |
140
|
|
|
} |
141
|
|
|
} |