Passed
Push — master ( 697d1a...ebeb83 )
by Matthijs
06:55
created
src/Services/Cart/Helpers/Helpers.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public static function isMultiArray($array, $recursive = false)
27 27
     {
28
-        if( $recursive )
28
+        if ($recursive)
29 29
         {
30 30
             return (count($array) == count($array, COUNT_RECURSIVE)) ? false : true;
31 31
         }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public static function issetAndHasValueOrAssignDefault(&$var, $default = false)
57 57
     {
58
-        if( (isset($var)) && ($var!='') ) return $var;
58
+        if ((isset($var)) && ($var != '')) return $var;
59 59
 
60 60
         return $default;
61 61
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public static function formatValue($value, $format_numbers, $config)
64 64
     {
65 65
        
66
-        if($format_numbers && $config['format_numbers']) {
66
+        if ($format_numbers && $config['format_numbers']) {
67 67
 
68 68
 
69 69
             return number_format($value, $config['decimals'], $config['dec_point'], $config['thousands_sep']);
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,16 +28,14 @@  discard block
 block discarded – undo
28 28
         if( $recursive )
29 29
         {
30 30
             return (count($array) == count($array, COUNT_RECURSIVE)) ? false : true;
31
-        }
32
-        else
31
+        } else
33 32
         {
34 33
             foreach ($array as $k => $v)
35 34
             {
36 35
                 if (is_array($v))
37 36
                 {
38 37
                     return true;
39
-                }
40
-                else
38
+                } else
41 39
                 {
42 40
                     return false;
43 41
                 }
@@ -55,7 +53,9 @@  discard block
 block discarded – undo
55 53
      */
56 54
     public static function issetAndHasValueOrAssignDefault(&$var, $default = false)
57 55
     {
58
-        if( (isset($var)) && ($var!='') ) return $var;
56
+        if( (isset($var)) && ($var!='') ) {
57
+            return $var;
58
+        }
59 59
 
60 60
         return $default;
61 61
     }
Please login to merge, or discard this patch.
src/Services/Cart/CartCondition.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $this->args = $args;
28 28
 
29
-        if( Helpers::isMultiArray($args) )
29
+        if (Helpers::isMultiArray($args))
30 30
         {
31 31
             Throw new InvalidConditionException('Multi dimensional array is not supported.');
32 32
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function applyConditionWithoutTax($totalOrSubTotalOrPrice)
129 129
     {
130
-        if(isset($this->getAttributes()['data']['value_ex_tax']) AND $this->args['value']) {
130
+        if (isset($this->getAttributes()['data']['value_ex_tax']) AND $this->args['value']) {
131 131
             return $this->apply($totalOrSubTotalOrPrice, $this->getAttributes()['data']['value_ex_tax']);            
132 132
         }
133 133
 
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
         // has a minus or plus sign so we can decide what to do with the
174 174
         // percentage, whether to add or subtract it to the total/subtotal/price
175 175
         // if we can't find any plus/minus sign, we will assume it as plus sign
176
-        if( $this->valueIsPercentage($conditionValue) )
176
+        if ($this->valueIsPercentage($conditionValue))
177 177
         {
178
-            if( $this->valueIsToBeSubtracted($conditionValue) )
178
+            if ($this->valueIsToBeSubtracted($conditionValue))
179 179
             {
180
-                $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
180
+                $value = Helpers::normalizePrice($this->cleanValue($conditionValue));
181 181
 
182 182
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
183 183
 
184 184
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
185 185
             }
186
-            else if ( $this->valueIsToBeAdded($conditionValue) )
186
+            else if ($this->valueIsToBeAdded($conditionValue))
187 187
             {
188
-                $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
188
+                $value = Helpers::normalizePrice($this->cleanValue($conditionValue));
189 189
 
190 190
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
191 191
 
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
         // next is we will check if it has a minus/plus sign so then we can just deduct it to total/subtotal/price
206 206
         else
207 207
         {
208
-            if( $this->valueIsToBeSubtracted($conditionValue) )
208
+            if ($this->valueIsToBeSubtracted($conditionValue))
209 209
             {
210
-                $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
210
+                $this->parsedRawValue = Helpers::normalizePrice($this->cleanValue($conditionValue));
211 211
 
212 212
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
213 213
             }
214
-            else if ( $this->valueIsToBeAdded($conditionValue) )
214
+            else if ($this->valueIsToBeAdded($conditionValue))
215 215
             {
216
-                $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
216
+                $this->parsedRawValue = Helpers::normalizePrice($this->cleanValue($conditionValue));
217 217
 
218 218
                 $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue);
219 219
             }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
      */
271 271
     protected function cleanValue($value)
272 272
     {
273
-        return str_replace(array('%','-','+'),'',$value);
273
+        return str_replace(array('%', '-', '+'), '', $value);
274 274
     }
275 275
 
276 276
     /**
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
         if( Helpers::isMultiArray($args) )
30 30
         {
31 31
             Throw new InvalidConditionException('Multi dimensional array is not supported.');
32
-        }
33
-        else
32
+        } else
34 33
         {
35 34
             $this->validate($this->args);
36 35
         }
@@ -182,16 +181,14 @@  discard block
 block discarded – undo
182 181
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
183 182
 
184 183
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
185
-            }
186
-            else if ( $this->valueIsToBeAdded($conditionValue) )
184
+            } else if ( $this->valueIsToBeAdded($conditionValue) )
187 185
             {
188 186
                 $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
189 187
 
190 188
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
191 189
 
192 190
                 $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue);
193
-            }
194
-            else
191
+            } else
195 192
             {
196 193
                 $value = Helpers::normalizePrice($conditionValue);
197 194
 
@@ -210,14 +207,12 @@  discard block
 block discarded – undo
210 207
                 $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
211 208
 
212 209
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
213
-            }
214
-            else if ( $this->valueIsToBeAdded($conditionValue) )
210
+            } else if ( $this->valueIsToBeAdded($conditionValue) )
215 211
             {
216 212
                 $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
217 213
 
218 214
                 $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue);
219
-            }
220
-            else
215
+            } else
221 216
             {
222 217
                 $this->parsedRawValue = Helpers::normalizePrice($conditionValue);
223 218
 
Please login to merge, or discard this patch.
src/Services/Cart/ItemCollection.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     protected $config;
15 15
 
16
-   /**
16
+    /**
17 17
      * ItemCollection constructor.
18 18
      * @param array|mixed $items
19 19
      */
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
         $newPrice = 0.00;
69 69
         $processed = 0;
70 70
 
71
-        if( $this->hasConditions() )
71
+        if ($this->hasConditions())
72 72
         {
73
-            if( is_array($this->conditions) )
73
+            if (is_array($this->conditions))
74 74
             {
75
-                foreach($this->conditions as $condition)
75
+                foreach ($this->conditions as $condition)
76 76
                 {
77
-                    if( $condition->getTarget() === 'item' )
77
+                    if ($condition->getTarget() === 'item')
78 78
                     {
79
-                        ( $processed > 0 ) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
79
+                        ($processed > 0) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
80 80
                         $newPrice = $condition->applyCondition($toBeCalculated);
81 81
                         $processed++;
82 82
                     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             }
85 85
             else
86 86
             {
87
-                if( $this['conditions']->getTarget() === 'item' )
87
+                if ($this['conditions']->getTarget() === 'item')
88 88
                 {
89 89
                     $newPrice = $this['conditions']->applyCondition($originalPrice);
90 90
                 }
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
         $newPrice = 0.00;
108 108
         $processed = 0;
109 109
 
110
-        if( $this->hasConditions() )
110
+        if ($this->hasConditions())
111 111
         {
112
-            if( is_array($this->conditions) )
112
+            if (is_array($this->conditions))
113 113
             {
114
-                foreach($this->conditions as $condition)
114
+                foreach ($this->conditions as $condition)
115 115
                 {
116
-                    if( $condition->getTarget() === 'item' )
116
+                    if ($condition->getTarget() === 'item')
117 117
                     {
118
-                        ( $processed > 0 ) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
118
+                        ($processed > 0) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
119 119
                         $newPrice = $condition->applyCondition($toBeCalculated);
120 120
                         $processed++;
121 121
                     }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             }
124 124
             else
125 125
             {
126
-                if( $this['conditions']->getTarget() === 'item' )
126
+                if ($this['conditions']->getTarget() === 'item')
127 127
                 {
128 128
                     $newPrice = $this['conditions']->applyCondition($originalPrice);
129 129
                 }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
     public function __get($name)
161 161
     {
162
-        if( $this->has($name) ) return $this->get($name);
162
+        if ($this->has($name)) return $this->get($name);
163 163
         return null;
164 164
     }
165 165
 
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function hasConditions()
172 172
     {
173
-        if( ! isset($this['conditions']) ) return false;
174
-        if( is_array($this['conditions']) )
173
+        if (!isset($this['conditions'])) return false;
174
+        if (is_array($this['conditions']))
175 175
         {
176 176
             return count($this['conditions']) > 0;
177 177
         }
178 178
         $conditionInstance = "Hideyo\\Services\\Cart\\CartCondition";
179
-        if( $this['conditions'] instanceof $conditionInstance ) return true;
179
+        if ($this['conditions'] instanceof $conditionInstance) return true;
180 180
         return false;
181 181
     }
182 182
     
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function getConditions()
189 189
     {
190
-        if(! $this->hasConditions() ) return [];
190
+        if (!$this->hasConditions()) return [];
191 191
         return $this['conditions'];
192 192
     }
193 193
 }
194 194
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
                         $processed++;
82 82
                     }
83 83
                 }
84
-            }
85
-            else
84
+            } else
86 85
             {
87 86
                 if( $this['conditions']->getTarget() === 'item' )
88 87
                 {
@@ -120,8 +119,7 @@  discard block
 block discarded – undo
120 119
                         $processed++;
121 120
                     }
122 121
                 }
123
-            }
124
-            else
122
+            } else
125 123
             {
126 124
                 if( $this['conditions']->getTarget() === 'item' )
127 125
                 {
@@ -159,7 +157,9 @@  discard block
 block discarded – undo
159 157
 
160 158
     public function __get($name)
161 159
     {
162
-        if( $this->has($name) ) return $this->get($name);
160
+        if( $this->has($name) ) {
161
+            return $this->get($name);
162
+        }
163 163
         return null;
164 164
     }
165 165
 
@@ -170,13 +170,17 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function hasConditions()
172 172
     {
173
-        if( ! isset($this['conditions']) ) return false;
173
+        if( ! isset($this['conditions']) ) {
174
+            return false;
175
+        }
174 176
         if( is_array($this['conditions']) )
175 177
         {
176 178
             return count($this['conditions']) > 0;
177 179
         }
178 180
         $conditionInstance = "Hideyo\\Services\\Cart\\CartCondition";
179
-        if( $this['conditions'] instanceof $conditionInstance ) return true;
181
+        if( $this['conditions'] instanceof $conditionInstance ) {
182
+            return true;
183
+        }
180 184
         return false;
181 185
     }
182 186
     
@@ -187,7 +191,9 @@  discard block
 block discarded – undo
187 191
      */
188 192
     public function getConditions()
189 193
     {
190
-        if(! $this->hasConditions() ) return [];
194
+        if(! $this->hasConditions() ) {
195
+            return [];
196
+        }
191 197
         return $this['conditions'];
192 198
     }
193 199
 }
194 200
\ No newline at end of file
Please login to merge, or discard this patch.
src/Services/News/NewsService.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,24 +9,24 @@  discard block
 block discarded – undo
9 9
  
10 10
 class NewsService extends BaseService
11 11
 {
12
-	public function __construct(NewsRepository $news)
13
-	{
14
-		$this->repo = $news;
15
-	} 
12
+    public function __construct(NewsRepository $news)
13
+    {
14
+        $this->repo = $news;
15
+    } 
16 16
 
17 17
     public function selectByLimitAndOrderBy($shopId, $limit, $orderBy)
18 18
     {
19
-    	return $this->repo->selectByLimitAndOrderBy($shopId, $limit, $orderBy);
19
+        return $this->repo->selectByLimitAndOrderBy($shopId, $limit, $orderBy);
20 20
     }
21 21
 
22 22
     public function selectOneBySlug($shopId, $slug)
23 23
     {
24
-    	return $this->repo->selectOneBySlug($shopId, $slug);
24
+        return $this->repo->selectOneBySlug($shopId, $slug);
25 25
     }
26 26
 
27 27
     public function selectAllActiveGroupsByShopId($shopId)
28 28
     {
29
-    	return $this->repo->selectAllActiveGroupsByShopId($shopId);
29
+        return $this->repo->selectAllActiveGroupsByShopId($shopId);
30 30
     }
31 31
 
32 32
     public function findGroup($groupId)
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function selectAllGroups()
53 53
     {
54
-       return $this->repo->selectAllGroups();
54
+        return $this->repo->selectAllGroups();
55 55
     }
56 56
 
57 57
 
Please login to merge, or discard this patch.
src/Services/News/Entity/NewsImage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     protected $table = 'news_image';
15 15
 
16 16
     // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model.
17
-    protected $fillable = ['news_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id',];
17
+    protected $fillable = ['news_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id', ];
18 18
 
19 19
     public function news()
20 20
     {
Please login to merge, or discard this patch.
src/Services/ExtraField/ExtraFieldService.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         );
46 46
         
47 47
         if ($extraFieldId) {
48
-            $rules['title'] =   'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$extraFieldId.' = id';
48
+            $rules['title'] = 'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$extraFieldId.' = id';
49 49
         }
50 50
 
51 51
         return $rules;
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
  
9 9
 class ExtraFieldService extends BaseService
10 10
 {
11
-	public function __construct(ExtraFieldRepository $extraField)
12
-	{
13
-		$this->repo = $extraField;
14
-	}
11
+    public function __construct(ExtraFieldRepository $extraField)
12
+    {
13
+        $this->repo = $extraField;
14
+    }
15 15
 
16 16
     private function rulesValue($defaultValueId = false)
17 17
     {
Please login to merge, or discard this patch.
src/Services/SendingMethod/SendingMethodService.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
  
9 9
 class SendingMethodService extends BaseService
10 10
 {
11
-	public function __construct(SendingMethodRepository $sendingMethod)
12
-	{
13
-		$this->repo = $sendingMethod;
14
-	} 
11
+    public function __construct(SendingMethodRepository $sendingMethod)
12
+    {
13
+        $this->repo = $sendingMethod;
14
+    } 
15 15
 
16 16
     /**
17 17
      * The validation rules for the model.
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
         return $model;
126 126
     }
127 127
 
128
-	public function selectAllActiveByShopId($shopId)
128
+    public function selectAllActiveByShopId($shopId)
129 129
     {
130
-    	return $this->repo->selectAllActiveByShopId($shopId);
130
+        return $this->repo->selectAllActiveByShopId($shopId);
131 131
     }
132 132
 
133
-	public function selectOneByShopIdAndId($shopId, $sendingMethodId)
133
+    public function selectOneByShopIdAndId($shopId, $sendingMethodId)
134 134
     {
135
-    	$result = $this->repo->selectOneByShopIdAndId($shopId, $sendingMethodId);
135
+        $result = $this->repo->selectOneByShopIdAndId($shopId, $sendingMethodId);
136 136
 
137 137
         if ($result->isEmpty()) {
138 138
             return false;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
             'maximal_weight'    => 'numeric|nullable'
30 30
         );
31 31
         
32
-        if($sendingMethodId) {
33
-            $rules['title'] =   $rules['title'].','.$sendingMethodId.' = id';
32
+        if ($sendingMethodId) {
33
+            $rules['title'] = $rules['title'].','.$sendingMethodId.' = id';
34 34
         }
35 35
 
36 36
         return $rules;
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
             'name' => 'required|between:4,65|unique_with:sending_method_country_price, sending_method_id'
45 45
         );
46 46
         
47
-        if($id) {
48
-            $rules['name'] =   'required|between:4,65|unique_with:sending_method_country_price, sending_method_id, '.$id.' = id';
47
+        if ($id) {
48
+            $rules['name'] = 'required|between:4,65|unique_with:sending_method_country_price, sending_method_id, '.$id.' = id';
49 49
         }
50 50
 
51 51
         return $rules;
Please login to merge, or discard this patch.
src/Services/Brand/Entity/BrandImage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
      */
14 14
     protected $table = 'brand_image';
15 15
 
16
-    protected $guarded =  array('file');
16
+    protected $guarded = array('file');
17 17
 
18 18
     // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model.
19
-    protected $fillable = ['brand_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id',];
19
+    protected $fillable = ['brand_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id', ];
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
src/Services/Brand/Entity/Brand.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
     protected $scoped = array('shop_id');
21 21
 
22 22
     // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model.
23
-    protected $fillable = ['active',  'title', 'short_description', 'description', 'rank', 'meta_title', 'meta_description', 'meta_keywords', 'shop_id', 'modified_by_user_id'];
23
+    protected $fillable = ['active', 'title', 'short_description', 'description', 'rank', 'meta_title', 'meta_description', 'meta_keywords', 'shop_id', 'modified_by_user_id'];
24 24
 
25 25
     public function sluggable()
26 26
     {
Please login to merge, or discard this patch.