Completed
Pull Request — master (#309)
by Jason
05:20
created
src/ORM/CustomerExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
         // Grab customer_id record from FoxyCart response, store in Member
47 47
         if ($response) {
48 48
             $foxyResponse = new \SimpleXMLElement($response);
49
-            $this->owner->Customer_ID = (int) $foxyResponse->customer_id;
49
+            $this->owner->Customer_ID = (int)$foxyResponse->customer_id;
50 50
         }
51 51
     }
52 52
 }
Please login to merge, or discard this patch.
src/Controller/OrderHistoryPageController.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
     {
21 21
         if (Security::getCurrentUser()) {
22 22
             return true;
23
-        } else {
23
+        }else {
24 24
             return Security::permissionFailure($this, _t(
25 25
                 'AccountPage.CANNOTCONFIRMLOGGEDIN',
26 26
                 'Please login to view this page.'
Please login to merge, or discard this patch.
src/Model/FoxyStripeClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@
 block discarded – undo
262 262
         if ($client) {
263 263
             if ($category = $this->getCategory($data['code'])) {
264 264
                 $result = $client->patch($category, $data);
265
-            } else {
265
+            }else {
266 266
                 $result = $client->post($this->getItemCategoriesURL(), $data);
267 267
             }
268 268
             $errors = array_merge($errors, $client->getErrors($result));
Please login to merge, or discard this patch.
src/Controller/DonationProductController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
         if (SiteConfig::current_site_config()->CartValidation) {
45 45
             Requirements::javascript('framework/thirdparty/jquery-validate/jquery.validate.js');
46 46
             Requirements::javascriptTemplate('foxystripe/javascript/donationProduct.js', [
47
-                'Trigger' => (string) $currencyField->getAttribute('id'),
47
+                'Trigger' => (string)$currencyField->getAttribute('id'),
48 48
                 'UpdateURL' => Director::absoluteURL($this->Link('updatevalue')),
49 49
             ]);
50 50
         }
Please login to merge, or discard this patch.
src/Page/ProductHolder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@
 block discarded – undo
146 146
 
147 147
         if ($config->MultiGroup) {
148 148
             $entries = $this->Products()->sort('SortOrder');
149
-        } else {
149
+        }else {
150 150
             $filter = '"ParentID" = '.$this->ID;
151 151
 
152 152
             // Build a list of all IDs for ProductGroups that are children
Please login to merge, or discard this patch.
tests/ProductPageTest.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -215,41 +215,41 @@
 block discarded – undo
215 215
 
216 216
     public function testProductDraftOptionDeletion()
217 217
     {
218
-        self::$use_draft_site = false;//make sure we can publish
218
+        self::$use_draft_site = false; //make sure we can publish
219 219
 
220 220
         $this->logInWithPermission('ADMIN');
221 221
 
222
-        $holder = $this->objFromFixture(ProductHolder::class, 'default');//build holder page, ProductPage can't be on root level
222
+        $holder = $this->objFromFixture(ProductHolder::class, 'default'); //build holder page, ProductPage can't be on root level
223 223
         $holder->doPublish();
224 224
 
225
-        $product = $this->objFromFixture(ProductPage::class, 'product1');//build product page
225
+        $product = $this->objFromFixture(ProductPage::class, 'product1'); //build product page
226 226
         $product->doPublish();
227 227
 
228 228
         $productID = $product->ID;
229 229
 
230
-        $optionGroup = $this->objFromFixture(OptionGroup::class, 'size');//build the group for the options
230
+        $optionGroup = $this->objFromFixture(OptionGroup::class, 'size'); //build the group for the options
231 231
         $optionGroup->write();
232
-        $option = $this->objFromFixture(OptionItem::class, 'small');//build first option
232
+        $option = $this->objFromFixture(OptionItem::class, 'small'); //build first option
233 233
         $option->write();
234
-        $option2 = $this->objFromFixture(OptionItem::class, 'large');//build second option
234
+        $option2 = $this->objFromFixture(OptionItem::class, 'large'); //build second option
235 235
         $option2->write();
236 236
 
237
-        $this->assertTrue($product->isPublished());//check that product is published
237
+        $this->assertTrue($product->isPublished()); //check that product is published
238 238
 
239
-        $product->deleteFromStage('Stage');//remove product from draft site
239
+        $product->deleteFromStage('Stage'); //remove product from draft site
240 240
 
241
-        $this->assertTrue($product->isPublished());//check product is still published
241
+        $this->assertTrue($product->isPublished()); //check product is still published
242 242
 
243 243
         $testOption = $this->objFromFixture(OptionItem::class, 'large');
244 244
 
245
-        $this->assertThat($testOption->ID, $this->logicalNot($this->equalTo(0)));//make sure the first option still exists
245
+        $this->assertThat($testOption->ID, $this->logicalNot($this->equalTo(0))); //make sure the first option still exists
246 246
 
247
-        $product->doRestoreToStage();//restore page to draft site
248
-        $product->doUnpublish();//unpublish page
249
-        $product->deleteFromStage('Stage');//remove product from draft site
247
+        $product->doRestoreToStage(); //restore page to draft site
248
+        $product->doUnpublish(); //unpublish page
249
+        $product->deleteFromStage('Stage'); //remove product from draft site
250 250
 
251
-        $checkDeleted = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first();//query same option as above
251
+        $checkDeleted = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first(); //query same option as above
252 252
 
253
-        $this->assertEquals($checkDeleted->ID, 0);//check that the ID is 0 (empty object/non-existent)
253
+        $this->assertEquals($checkDeleted->ID, 0); //check that the ID is 0 (empty object/non-existent)
254 254
     }
255 255
 }
Please login to merge, or discard this patch.
src/Form/FoxyStripePurchaseForm.php 1 patch
Spacing   +6 added lines, -9 removed lines patch added patch discarded remove patch
@@ -105,12 +105,10 @@  discard block
 block discarded – undo
105 105
         $this->setSiteConfig($siteConfig);
106 106
 
107 107
         $fields = ($fields != null && $fields->exists()) ?
108
-            $this->getProductFields($fields) :
109
-            $this->getProductFields(FieldList::create());
108
+            $this->getProductFields($fields) : $this->getProductFields(FieldList::create());
110 109
 
111 110
         $actions = ($actions != null && $actions->exists()) ?
112
-            $this->getProductActions($actions) :
113
-            $this->getProductActions(FieldList::create());
111
+            $this->getProductActions($actions) : $this->getProductActions(FieldList::create());
114 112
         $validator = (!empty($validator) || $validator != null) ? $validator : RequiredFields::create();
115 113
 
116 114
         parent::__construct($controller, $name, $fields, $actions, $validator);
@@ -128,8 +126,7 @@  discard block
 block discarded – undo
128 126
     protected function getProductFields(FieldList $fields)
129 127
     {
130 128
         $hiddenTitle = ($this->product->ReceiptTitle) ?
131
-            htmlspecialchars($this->product->ReceiptTitle) :
132
-            htmlspecialchars($this->product->Title);
129
+            htmlspecialchars($this->product->ReceiptTitle) : htmlspecialchars($this->product->Title);
133 130
         $code = $this->product->Code;
134 131
 
135 132
         if ($this->product->Available) {
@@ -157,7 +154,7 @@  discard block
 block discarded – undo
157 154
                 $code,
158 155
                 'price',
159 156
                 $this->product->Price
160
-            ))->setValue($this->product->Price));//can't override id
157
+            ))->setValue($this->product->Price)); //can't override id
161 158
             $fields->push(HiddenField::create(ProductPage::getGeneratedValue(
162 159
                 $code,
163 160
                 'weight',
@@ -200,7 +197,7 @@  discard block
 block discarded – undo
200 197
                 ->addExtraClass('hidden unavailable-text'));
201 198
 
202 199
             $this->extend('updatePurchaseFormFields', $fields);
203
-        } else {
200
+        }else {
204 201
             $fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock'), 4);
205 202
         }
206 203
 
@@ -246,7 +243,7 @@  discard block
 block discarded – undo
246 243
      */
247 244
     protected function getProductOptionSet()
248 245
     {
249
-        $assignAvailable = function ($self) {
246
+        $assignAvailable = function($self) {
250 247
             $this->extend('updateFoxyStripePurchaseForm', $form);
251 248
             $self->Available = ($self->getAvailability()) ? true : false;
252 249
         };
Please login to merge, or discard this patch.
src/Model/foxycart.cart_validation.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
                                 .'$1', $input);
330 330
                         }
331 331
                         self::$log[] = '<strong>INPUT:</strong> Code: <strong>'.htmlspecialchars($prefix.$code).
332
-                           '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$name[2]).
333
-                           '</strong> :: Value: <strong>'.htmlspecialchars($value[2]).
334
-                           '</strong><br />Initial input: '.htmlspecialchars($input).
335
-                           '<br />Signed: <span style="color:#060;">'.htmlspecialchars($input_signed).'</span>';
332
+                            '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$name[2]).
333
+                            '</strong> :: Value: <strong>'.htmlspecialchars($value[2]).
334
+                            '</strong><br />Initial input: '.htmlspecialchars($input).
335
+                            '<br />Signed: <span style="color:#060;">'.htmlspecialchars($input_signed).'</span>';
336 336
                         $form = str_replace($input, $input_signed, $form);
337 337
                     }
338 338
                 }
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
                         );
374 374
                         $form_part_signed = str_replace($option[0], $option_signed, $form_part_signed);
375 375
                         self::$log[] = '<strong>OPTION:</strong> Code: <strong>'.htmlspecialchars($prefix.$code).
376
-                           '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$list[2]).
377
-                           '</strong> :: Value: <strong>'.htmlspecialchars($option[2]).
378
-                           '</strong><br />Initial option: '.htmlspecialchars($option[0]).
379
-                           '<br />Signed: <span style="color:#060;">'.htmlspecialchars($option_signed).'</span>';
376
+                            '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$list[2]).
377
+                            '</strong> :: Value: <strong>'.htmlspecialchars($option[2]).
378
+                            '</strong><br />Initial option: '.htmlspecialchars($option[0]).
379
+                            '<br />Signed: <span style="color:#060;">'.htmlspecialchars($option_signed).'</span>';
380 380
                     }
381 381
                     $form = str_replace($list[0], $form_part_signed, $form);
382 382
                 }
@@ -407,10 +407,10 @@  discard block
 block discarded – undo
407 407
                     );
408 408
                     $form = str_replace($textarea[0], $textarea_signed, $form);
409 409
                     self::$log[] = '<strong>TEXTAREA:</strong> Code: <strong>'.htmlspecialchars($prefix.$code).
410
-                       '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$textarea[2]).
411
-                       '</strong> :: Value: <strong>'.htmlspecialchars($textarea[3]).
412
-                       '</strong><br />Initial textarea: '.htmlspecialchars($textarea[0]).
413
-                       '<br />Signed: <span style="color:#060;">'.htmlspecialchars($textarea_signed).'</span>';
410
+                        '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$textarea[2]).
411
+                        '</strong> :: Value: <strong>'.htmlspecialchars($textarea[3]).
412
+                        '</strong><br />Initial textarea: '.htmlspecialchars($textarea[0]).
413
+                        '<br />Signed: <span style="color:#060;">'.htmlspecialchars($textarea_signed).'</span>';
414 414
                 }
415 415
                 self::$log[] = '<strong>FORM after TEXTAREAS:</strong> <pre>'.htmlspecialchars($form).'</pre>';
416 416
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
         if ($output) {
161 161
             echo self::$cart_url.'?'.$qs;
162
-        } else {
162
+        }else {
163 163
             return self::$cart_url.'?'.$qs;
164 164
         }
165 165
     }
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
         if ($option_value == '--OPEN--') {
184 184
             $hash = hash_hmac('sha256', $product_code.$option_name.$option_value, self::getSecret());
185 185
             $value = ($urlencode) ? urlencode($option_name).'||'.$hash.'||open' : $option_name.'||'.$hash.'||open';
186
-        } else {
186
+        }else {
187 187
             $hash = hash_hmac('sha256', $product_code.$option_name.$option_value, self::getSecret());
188 188
             if ($method == 'name') {
189 189
                 $value = ($urlencode) ? urlencode($option_name).'||'.$hash : $option_name.'||'.$hash;
190
-            } else {
190
+            }else {
191 191
                 $value = ($urlencode) ? urlencode($option_value).'||'.$hash : $option_value.'||'.$hash;
192 192
             }
193 193
         }
194 194
 
195 195
         if ($output) {
196 196
             echo $value;
197
-        } else {
197
+        }else {
198 198
             return $value;
199 199
         }
200 200
     }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
                                 .preg_quote($value[2]).'\1%', '${1}'
323 323
                                 .self::fc_hash_value($code, $name[2], $value[2], 'value', false)
324 324
                                 .'$1', $input);
325
-                        } else {
325
+                        }else {
326 326
                             $input_signed = preg_replace('%([\'"])'.$prefix.preg_quote($name[2])
327 327
                                 .'\1%', '${1}'.$prefix
328 328
                                 .self::fc_hash_value($code, $name[2], $value[2], 'name', false)
Please login to merge, or discard this patch.
src/Model/OptionItem.php 1 patch
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $parentCode = $product->Code;
111 111
 
112 112
         // ProductOptionGroup Dropdown field w/ add new
113
-        $groups = function () {
113
+        $groups = function() {
114 114
             return OptionGroup::get()->map()->toArray();
115 115
         };
116 116
         $groupFields = singleton(OptionGroup::class)->getCMSFields();
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
      */
321 321
     public function getGeneratedValue()
322 322
     {
323
-        $modPrice = ($this->PriceModifier) ? (string) $this->PriceModifier : '0';
323
+        $modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0';
324 324
         $modPriceWithSymbol = self::getOptionModifierActionSymbol($this->PriceModifierAction).$modPrice;
325
-        $modWeight = ($this->WeightModifier) ? (string) $this->WeightModifier : '0';
325
+        $modWeight = ($this->WeightModifier) ? (string)$this->WeightModifier : '0';
326 326
         $modWeight = self::getOptionModifierActionSymbol($this->WeightModifierAction).$modWeight;
327 327
         $modCode = self::getOptionModifierActionSymbol($this->CodeModifierAction).$this->CodeModifier;
328 328
 
@@ -334,14 +334,13 @@  discard block
 block discarded – undo
334 334
      */
335 335
     public function getGeneratedTitle()
336 336
     {
337
-        $modPrice = ($this->PriceModifier) ? (string) $this->PriceModifier : '0';
337
+        $modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0';
338 338
         $title = $this->Title;
339 339
         $title .= ($this->PriceModifier != 0) ?
340 340
             ': ('.self::getOptionModifierActionSymbol(
341 341
                 $this->PriceModifierAction,
342 342
                 $returnWithOnlyPlusMinus = true
343
-            ).'$'.$modPrice.')' :
344
-            '';
343
+            ).'$'.$modPrice.')' : '';
345 344
 
346 345
         return $title;
347 346
     }
Please login to merge, or discard this patch.