Passed
Branch master (ab31be)
by Vojta
06:52
created
Plugin.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,20 +45,20 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,5 @@
 block discarded – undo
1 1
 <?php namespace VojtaSvoboda\CnbRates;
2 2
 
3
-use Backend;
4 3
 use System\Classes\PluginBase;
5 4
 use VojtaSvoboda\CnbRates\Models\Settings;
6 5
 
Please login to merge, or discard this patch.
models/Settings.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
6 6
 
7 7
 class Settings extends Model
8 8
 {
9
-	public $implement = ['System.Behaviors.SettingsModel'];
9
+    public $implement = ['System.Behaviors.SettingsModel'];
10 10
 
11
-	// A unique code
12
-	public $settingsCode = 'vojtasvoboda_cnbrates_settings';
11
+    // A unique code
12
+    public $settingsCode = 'vojtasvoboda_cnbrates_settings';
13 13
 
14
-	// Reference to field configuration
15
-	public $settingsFields = 'fields.yaml';
14
+    // Reference to field configuration
15
+    public $settingsFields = 'fields.yaml';
16 16
 
17 17
 }
Please login to merge, or discard this patch.
providers/CnbDataProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
services/BaseService.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      *
23 23
      * @param $date
24 24
      *
25
-     * @return array
25
+     * @return string
26 26
      */
27 27
     public function getDataSource($date = null)
28 28
     {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      *
62 62
      * @param $date
63 63
      *
64
-     * @return mixed
64
+     * @return string
65 65
      */
66 66
     public function getSourceUrl($date = null)
67 67
     {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     /**
102 102
      * Transform data source to array
103 103
      *
104
-     * @param $source
104
+     * @param string $source
105 105
      * @param int $keyIndex
106 106
      *
107 107
      * @return array
Please login to merge, or discard this patch.
services/ExchangeRateService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
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
             {
Please login to merge, or discard this patch.
services/PriborService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.