Test Failed
Pull Request — master (#14)
by
unknown
02:40
created
src/Model/Table/CurrencyratesTable.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@
 block discarded – undo
44 44
             ->maxLength('from', 5)
45 45
             ->notEmpty('from');
46 46
 
47
-    	$validator
47
+        $validator
48 48
             ->scalar('to')
49 49
             ->maxLength('to', 5)
50 50
             ->notEmpty('to');
51 51
 
52
-    	$validator
52
+        $validator
53 53
             ->scalar('rate')
54 54
             ->maxLength('rate', 10)
55 55
             ->notEmpty('rate');
Please login to merge, or discard this patch.
src/Controller/Component/CurrencyConverterComponent.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,12 +94,16 @@
 block discarded – undo
94 94
      */
95 95
     public function getRateToUse($from, $to)
96 96
     {
97
-        if ($from == $to) return 1;
97
+        if ($from == $to) {
98
+            return 1;
99
+        }
98 100
         if ($this->database) {
99 101
             // Get a currency rate from table
100 102
             $result = $this->_currencyratesTable->find('all')->where(['from_currency' => $from, 'to_currency' => $to])->first();
101 103
             // If currency rate is in table and it doesn't have to be updated
102
-            if ($result && $result->modified->wasWithinLast($this->refresh . ' hours')) return $rate = $result->rate;
104
+            if ($result && $result->modified->wasWithinLast($this->refresh . ' hours')) {
105
+                return $rate = $result->rate;
106
+            }
103 107
             // If currency rate is in table and it have to be updated
104 108
             if ($result && !$result->modified->wasWithinLast($this->refresh . ' hours')) {
105 109
                 if ($rate = $this->_getRateFromAPI($from, $to)) {
Please login to merge, or discard this patch.
src/View/Helper/CurrencyConverterHelper.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,12 +94,16 @@
 block discarded – undo
94 94
      */
95 95
     public function getRateToUse($from, $to)
96 96
     {
97
-        if ($from == $to) return 1;
97
+        if ($from == $to) {
98
+            return 1;
99
+        }
98 100
         if ($this->database) {
99 101
             // Get a currency rate from table
100 102
             $result = $this->_currencyratesTable->find('all')->where(['from_currency' => $from, 'to_currency' => $to])->first();
101 103
             // If currency rate is in table and it doesn't have to be updated
102
-            if ($result && $result->modified->wasWithinLast($this->refresh . ' hours')) return $rate = $result->rate;
104
+            if ($result && $result->modified->wasWithinLast($this->refresh . ' hours')) {
105
+                return $rate = $result->rate;
106
+            }
103 107
             // If currency rate is in table and it have to be updated
104 108
             if ($result && !$result->modified->wasWithinLast($this->refresh . ' hours')) {
105 109
                 if ($rate = $this->_getRateFromAPI($from, $to)) {
Please login to merge, or discard this patch.