Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
45 | public function convertAmount(){ |
||
46 | $xml = XmlParser::load('http://www.bnm.org/ro/official_exchange_rates?get_xml=1&date='.date("d.m.Y")); |
||
47 | |||
48 | $parsed = $xml->parse([ |
||
49 | 'cursToDay' => ['uses' => 'Valute[CharCode,Value]'], |
||
50 | ]); |
||
51 | |||
52 | $currency = array('EUR','USD'); |
||
53 | $json = array(); |
||
54 | foreach ($parsed as $key => $item) { |
||
55 | foreach ($item as $key => $val) { |
||
56 | if (in_array($val['CharCode'], $currency)) { |
||
57 | $json[$val['CharCode']] = $val['Value']; |
||
58 | } |
||
59 | } |
||
60 | } |
||
61 | $put = Storage::put('json_currency.json', json_encode($json)); |
||
62 | } |
||
63 | } |
||
64 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.