1 | <?php |
||
13 | class ExchangeRate |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * Внутренний код валюты |
||
18 | * @var int |
||
19 | */ |
||
20 | private $id; |
||
21 | |||
22 | /** |
||
23 | * цифровой код |
||
24 | * @var int |
||
25 | */ |
||
26 | private $numCode; |
||
27 | |||
28 | /** |
||
29 | * буквенный код |
||
30 | * @var string |
||
31 | */ |
||
32 | private $charCode; |
||
33 | |||
34 | /** |
||
35 | * номинал |
||
36 | * @var int |
||
37 | */ |
||
38 | private $scale; |
||
39 | |||
40 | /** |
||
41 | * наименование валюты |
||
42 | * @var string |
||
43 | */ |
||
44 | private $name; |
||
45 | |||
46 | /** |
||
47 | * курс |
||
48 | * @var float |
||
49 | */ |
||
50 | private $rate; |
||
51 | |||
52 | /** |
||
53 | * @var \DateTime |
||
54 | */ |
||
55 | private $date; |
||
56 | |||
57 | /** |
||
58 | * ExchangeRate constructor. |
||
59 | * @param int $id |
||
60 | * @param int $numCode |
||
61 | * @param string $charCode |
||
62 | * @param int $scale |
||
63 | * @param string $name |
||
64 | * @param float $rate |
||
65 | * @param \DateTime $date |
||
66 | */ |
||
67 | public function __construct($id, $numCode, $charCode, $scale, $name, $rate, \DateTime $date) |
||
77 | |||
78 | |||
79 | static public function createFromXML(\SimpleXMLElement $xmlElement = null, \DateTime $date) |
||
91 | |||
92 | |||
93 | /** |
||
94 | * @return int |
||
95 | */ |
||
96 | public function getId() |
||
100 | |||
101 | /** |
||
102 | * @return int |
||
103 | */ |
||
104 | public function getNumCode() |
||
108 | |||
109 | |||
110 | /** |
||
111 | * @return string |
||
112 | */ |
||
113 | public function getCharCode() |
||
117 | |||
118 | /** |
||
119 | * @return string |
||
120 | */ |
||
121 | public function getName() |
||
125 | |||
126 | /** |
||
127 | * @return float |
||
128 | */ |
||
129 | public function getRate() |
||
133 | |||
134 | /** |
||
135 | * @return int |
||
136 | */ |
||
137 | public function getScale() |
||
141 | |||
142 | /** |
||
143 | * @return \DateTime |
||
144 | */ |
||
145 | public function getDate() |
||
149 | |||
150 | |||
151 | } |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: