@@ -45,20 +45,20 @@ |
||
| 45 | 45 | public function registerSchedule($schedule) |
| 46 | 46 | { |
| 47 | 47 | // Exchange service daily update when allowed by Settings |
| 48 | - $schedule->call(function () { |
|
| 48 | + $schedule->call(function() { |
|
| 49 | 49 | $cnb = $this->app->make('cnb'); |
| 50 | 50 | $cnb->updateTodayExchangeRates(); |
| 51 | 51 | |
| 52 | - })->daily()->when(function () { |
|
| 52 | + })->daily()->when(function() { |
|
| 53 | 53 | return !!Settings::get('exchange', true); |
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | 56 | // PRIBOR service daily update when allowed by Settings |
| 57 | - $schedule->call(function () { |
|
| 57 | + $schedule->call(function() { |
|
| 58 | 58 | $cnb = $this->app->make('cnb'); |
| 59 | 59 | $cnb->updateTodayPriborRates(); |
| 60 | 60 | |
| 61 | - })->daily()->when(function () { |
|
| 61 | + })->daily()->when(function() { |
|
| 62 | 62 | return !!Settings::get('pribor', true); |
| 63 | 63 | }); |
| 64 | 64 | } |
@@ -26,14 +26,14 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function getData($url, $date = null, $ident = null) |
| 28 | 28 | { |
| 29 | - if(!$url) { |
|
| 29 | + if (!$url) { |
|
| 30 | 30 | throw new \Exception("Service URL can't be empty."); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $dateObj = new \DateTime($date); |
| 34 | 34 | $date = $dateObj->format('d.m.Y'); |
| 35 | 35 | |
| 36 | - if(!$this->isFileExists($date, $ident)) { |
|
| 36 | + if (!$this->isFileExists($date, $ident)) { |
|
| 37 | 37 | $this->saveDataToFile($this->loadDataFromUrl($url), $date, $ident); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | private function getFilePath($date, $ident = null) |
| 109 | 109 | { |
| 110 | - if(!$ident) { |
|
| 110 | + if (!$ident) { |
|
| 111 | 111 | $ident = $this->undefinedFolderName; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -122,16 +122,16 @@ discard block |
||
| 122 | 122 | private function checkCacheFolder($ident) |
| 123 | 123 | { |
| 124 | 124 | $cacheFolder = temp_path($this->cachePathPrefix . '/'); |
| 125 | - if(!file_exists($cacheFolder)) { |
|
| 125 | + if (!file_exists($cacheFolder)) { |
|
| 126 | 126 | mkdir($cacheFolder); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if(!$ident) { |
|
| 129 | + if (!$ident) { |
|
| 130 | 130 | $ident = $this->undefinedFolderName; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $identFolder = temp_path($this->cachePathPrefix . '/' . $ident . '/'); |
| 134 | - if(!file_exists($identFolder)) { |
|
| 134 | + if (!file_exists($identFolder)) { |
|
| 135 | 135 | mkdir($identFolder); |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | { |
| 96 | 96 | $r = []; |
| 97 | 97 | $lines = preg_split('/\r\n|\n|\r/', trim($source)); |
| 98 | - foreach($lines as $key => $line) |
|
| 98 | + foreach ($lines as $key => $line) |
|
| 99 | 99 | { |
| 100 | 100 | // file headers |
| 101 | 101 | if ($key < 3) { |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | $rates = $this->getData($date, $keyIndex = 3); |
| 21 | 21 | $r = []; |
| 22 | 22 | |
| 23 | - foreach($rates as $key => $rate) |
|
| 23 | + foreach ($rates as $key => $rate) |
|
| 24 | 24 | { |
| 25 | 25 | if (sizeof($rate) >= 4) |
| 26 | 26 | { |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $intervalKeys = $this->getIntervalKeys(); |
| 22 | 22 | $r = []; |
| 23 | 23 | |
| 24 | - foreach($data as $key => $rate) { |
|
| 24 | + foreach ($data as $key => $rate) { |
|
| 25 | 25 | if (isset($intervalKeys[$key])) { |
| 26 | 26 | $r[$intervalKeys[$key]] = round(floatval(strtr($rate[2], [',' => '.'])), 2); |
| 27 | 27 | } |