Completed
Push — master ( 55ed81...7773cb )
by Nic
04:32
created
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/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.
tests/ProductPageTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 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
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         //build holder page, ProductPage can't be on root level
224 224
         $holder->doPublish();
225 225
 
226
-        $product = $this->objFromFixture(ProductPage::class, 'product1');//build product page
226
+        $product = $this->objFromFixture(ProductPage::class, 'product1'); //build product page
227 227
         $product->doPublish();
228 228
 
229 229
         $productID = $product->ID;
@@ -231,29 +231,29 @@  discard block
 block discarded – undo
231 231
         $optionGroup = $this->objFromFixture(OptionGroup::class, 'size');
232 232
         //build the group for the options
233 233
         $optionGroup->write();
234
-        $option = $this->objFromFixture(OptionItem::class, 'small');//build first option
234
+        $option = $this->objFromFixture(OptionItem::class, 'small'); //build first option
235 235
         $option->write();
236
-        $option2 = $this->objFromFixture(OptionItem::class, 'large');//build second option
236
+        $option2 = $this->objFromFixture(OptionItem::class, 'large'); //build second option
237 237
         $option2->write();
238 238
 
239
-        $this->assertTrue($product->isPublished());//check that product is published
239
+        $this->assertTrue($product->isPublished()); //check that product is published
240 240
 
241
-        $product->deleteFromStage('Stage');//remove product from draft site
241
+        $product->deleteFromStage('Stage'); //remove product from draft site
242 242
 
243
-        $this->assertTrue($product->isPublished());//check product is still published
243
+        $this->assertTrue($product->isPublished()); //check product is still published
244 244
 
245 245
         $testOption = $this->objFromFixture(OptionItem::class, 'large');
246 246
 
247 247
         $this->assertThat($testOption->ID, $this->logicalNot($this->equalTo(0)));
248 248
         //make sure the first option still exists
249 249
 
250
-        $product->doRestoreToStage();//restore page to draft site
251
-        $product->doUnpublish();//unpublish page
252
-        $product->deleteFromStage('Stage');//remove product from draft site
250
+        $product->doRestoreToStage(); //restore page to draft site
251
+        $product->doUnpublish(); //unpublish page
252
+        $product->deleteFromStage('Stage'); //remove product from draft site
253 253
 
254 254
         $checkDeleted = OptionItem::get()->filter(array('Title' => 'Large', 'ProductID' => $productID))->first();
255 255
         //query same option as above
256 256
 
257
-        $this->assertEquals($checkDeleted->ID, 0);//check that the ID is 0 (empty object/non-existent)
257
+        $this->assertEquals($checkDeleted->ID, 0); //check that the ID is 0 (empty object/non-existent)
258 258
     }
259 259
 }
Please login to merge, or discard this patch.
src/Admin/FoxyStripeAdmin.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         // Retrieve validator, if one has been setup (e.g. via data extensions).
89 89
         if ($config->hasMethod('getCMSValidator')) {
90 90
             $validator = $config->getCMSValidator();
91
-        } else {
91
+        }else {
92 92
             $validator = null;
93 93
         }
94 94
 
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
             $actions,
102 102
             $validator
103 103
         )->setHTMLID('Form_EditForm');
104
-        $form->setValidationResponseCallback(function (ValidationResult $errors) use ($negotiator, $form) {
104
+        $form->setValidationResponseCallback(function(ValidationResult $errors) use ($negotiator, $form) {
105 105
             $request = $this->getRequest();
106 106
             if ($request->isAjax() && $negotiator) {
107 107
                 $result = $form->forTemplate();
108 108
 
109 109
                 return $negotiator->respond($request, array(
110
-                    'CurrentForm' => function () use ($result) {
110
+                    'CurrentForm' => function() use ($result) {
111 111
                         return $result;
112 112
                     },
113 113
                 ));
Please login to merge, or discard this patch.
src/Model/Order.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $this->parseOrderDetails($response);
212 212
 
213 213
             return true;
214
-        } else {
214
+        }else {
215 215
             return false;
216 216
         }
217 217
     }
@@ -223,14 +223,14 @@  discard block
 block discarded – undo
223 223
     {
224 224
         foreach ($response->transactions->transaction as $transaction) {
225 225
             // Record transaction data from FoxyCart Datafeed:
226
-            $this->Store_ID = (int) $transaction->store_id;
227
-            $this->TransactionDate = (string) $transaction->transaction_date;
228
-            $this->ProductTotal = (float) $transaction->product_total;
229
-            $this->TaxTotal = (float) $transaction->tax_total;
230
-            $this->ShippingTotal = (float) $transaction->shipping_total;
231
-            $this->OrderTotal = (float) $transaction->order_total;
232
-            $this->ReceiptURL = (string) $transaction->receipt_url;
233
-            $this->OrderStatus = (string) $transaction->status;
226
+            $this->Store_ID = (int)$transaction->store_id;
227
+            $this->TransactionDate = (string)$transaction->transaction_date;
228
+            $this->ProductTotal = (float)$transaction->product_total;
229
+            $this->TaxTotal = (float)$transaction->tax_total;
230
+            $this->ShippingTotal = (float)$transaction->shipping_total;
231
+            $this->OrderTotal = (float)$transaction->order_total;
232
+            $this->ReceiptURL = (string)$transaction->receipt_url;
233
+            $this->OrderStatus = (string)$transaction->status;
234 234
 
235 235
             $this->extend('handleOrderInfo', $order, $response);
236 236
         }
@@ -249,18 +249,18 @@  discard block
 block discarded – undo
249 249
                 if (Member::get()->filter('Email', $transaction->customer_email)->First()) {
250 250
                     $customer = Member::get()->filter('Email', $transaction->customer_email)->First();
251 251
                     // if new customer, create account with data from FoxyCart
252
-                } else {
252
+                }else {
253 253
                     // set PasswordEncryption to 'none' so imported, encrypted password is not encrypted again
254 254
                     Config::modify()->set(Security::class, 'password_encryption_algorithm', 'none');
255 255
 
256 256
                     // create new Member, set password info from FoxyCart
257 257
                     $customer = Member::create();
258
-                    $customer->Customer_ID = (int) $transaction->customer_id;
259
-                    $customer->FirstName = (string) $transaction->customer_first_name;
260
-                    $customer->Surname = (string) $transaction->customer_last_name;
261
-                    $customer->Email = (string) $transaction->customer_email;
262
-                    $customer->Password = (string) $transaction->customer_password;
263
-                    $customer->Salt = (string) $transaction->customer_password_salt;
258
+                    $customer->Customer_ID = (int)$transaction->customer_id;
259
+                    $customer->FirstName = (string)$transaction->customer_first_name;
260
+                    $customer->Surname = (string)$transaction->customer_last_name;
261
+                    $customer->Email = (string)$transaction->customer_email;
262
+                    $customer->Password = (string)$transaction->customer_password;
263
+                    $customer->Salt = (string)$transaction->customer_password_salt;
264 264
                     $customer->PasswordEncryption = 'none';
265 265
 
266 266
                     // record member record
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
             foreach ($transaction->transaction_details->transaction_detail as $detail) {
298 298
                 $OrderDetail = OrderDetail::create();
299 299
 
300
-                $OrderDetail->Quantity = (int) $detail->product_quantity;
301
-                $OrderDetail->ProductName = (string) $detail->product_name;
302
-                $OrderDetail->ProductCode = (string) $detail->product_code;
303
-                $OrderDetail->ProductImage = (string) $detail->image;
304
-                $OrderDetail->ProductCategory = (string) $detail->category_code;
300
+                $OrderDetail->Quantity = (int)$detail->product_quantity;
301
+                $OrderDetail->ProductName = (string)$detail->product_name;
302
+                $OrderDetail->ProductCode = (string)$detail->product_code;
303
+                $OrderDetail->ProductImage = (string)$detail->image;
304
+                $OrderDetail->ProductCategory = (string)$detail->category_code;
305 305
                 $priceModifier = 0;
306 306
 
307 307
                 // parse OrderOptions
@@ -309,14 +309,14 @@  discard block
 block discarded – undo
309 309
                     // Find product via product_id custom variable
310 310
                     if ($option->product_option_name == 'product_id') {
311 311
                         // if product is found, set relation to OrderDetail
312
-                        $OrderProduct = ProductPage::get()->byID((int) $option->product_option_value);
312
+                        $OrderProduct = ProductPage::get()->byID((int)$option->product_option_value);
313 313
                         if ($OrderProduct) {
314 314
                             $OrderDetail->ProductID = $OrderProduct->ID;
315 315
                         }
316
-                    } else {
316
+                    }else {
317 317
                         $OrderOption = OrderOption::create();
318
-                        $OrderOption->Name = (string) $option->product_option_name;
319
-                        $OrderOption->Value = (string) $option->product_option_value;
318
+                        $OrderOption->Name = (string)$option->product_option_name;
319
+                        $OrderOption->Value = (string)$option->product_option_value;
320 320
                         $OrderOption->write();
321 321
                         $OrderDetail->OrderOptions()->add($OrderOption);
322 322
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
                     }
325 325
                 }
326 326
 
327
-                $OrderDetail->Price = (float) $detail->product_price + (float) $priceModifier;
327
+                $OrderDetail->Price = (float)$detail->product_price + (float)$priceModifier;
328 328
 
329 329
                 // extend OrderDetail parsing, allowing for recording custom fields from FoxyCart
330 330
                 $this->extend('handleOrderItem', $order, $response, $OrderDetail);
Please login to merge, or discard this patch.
src/Model/FoxyStripeSetting.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
                 FormAction::create('save_foxystripe_setting', _t('FoxyStripeSetting.SAVE', 'Save'))
333 333
                     ->addExtraClass('btn-primary font-icon-save')
334 334
             );
335
-        } else {
335
+        }else {
336 336
             $actions = FieldList::create();
337 337
         }
338 338
         $this->extend('updateCMSActions', $actions);
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
             }
361 361
             $config->StoreKey = $key;
362 362
             $config->write();
363
-            DB::alteration_message('Created FoxyCart Store Key ' . $key, 'created');
363
+            DB::alteration_message('Created FoxyCart Store Key '.$key, 'created');
364 364
         }
365 365
     }
366 366
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
      */
463 463
     private static function getSSOLink()
464 464
     {
465
-        return Director::absoluteBaseURL() . 'foxystripe/sso/';
465
+        return Director::absoluteBaseURL().'foxystripe/sso/';
466 466
     }
467 467
 
468 468
     /**
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
      */
471 471
     private static function getDataFeedLink()
472 472
     {
473
-        return Director::absoluteBaseURL() . 'foxystripe/';
473
+        return Director::absoluteBaseURL().'foxystripe/';
474 474
     }
475 475
 
476 476
     /**
Please login to merge, or discard this patch.
src/Model/OptionItem.php 1 patch
Spacing   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -123,8 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
         // set variables from Product
125 125
         $productID = ($this->ProductID != 0) ?
126
-            $this->ProductID :
127
-            Controller::curr()->getRequest()->getSession()->get('CMSMain.currentPage');
126
+            $this->ProductID : Controller::curr()->getRequest()->getSession()->get('CMSMain.currentPage');
128 127
 
129 128
         /** @var ProductPage $product */
130 129
         $product = ProductPage::get()->byID($productID);
@@ -134,7 +133,7 @@  discard block
 block discarded – undo
134 133
         $parentCode = $product->Code;
135 134
 
136 135
         // ProductOptionGroup Dropdown field w/ add new
137
-        $groups = function () {
136
+        $groups = function() {
138 137
             return OptionGroup::get()->map()->toArray();
139 138
         };
140 139
         $groupFields = singleton(OptionGroup::class)->getCMSFields();
@@ -344,9 +343,9 @@  discard block
 block discarded – undo
344 343
      */
345 344
     public function getGeneratedValue()
346 345
     {
347
-        $modPrice = ($this->PriceModifier) ? (string) $this->PriceModifier : '0';
346
+        $modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0';
348 347
         $modPriceWithSymbol = self::getOptionModifierActionSymbol($this->PriceModifierAction).$modPrice;
349
-        $modWeight = ($this->WeightModifier) ? (string) $this->WeightModifier : '0';
348
+        $modWeight = ($this->WeightModifier) ? (string)$this->WeightModifier : '0';
350 349
         $modWeight = self::getOptionModifierActionSymbol($this->WeightModifierAction).$modWeight;
351 350
         $modCode = self::getOptionModifierActionSymbol($this->CodeModifierAction).$this->CodeModifier;
352 351
 
@@ -358,14 +357,13 @@  discard block
 block discarded – undo
358 357
      */
359 358
     public function getGeneratedTitle()
360 359
     {
361
-        $modPrice = ($this->PriceModifier) ? (string) $this->PriceModifier : '0';
360
+        $modPrice = ($this->PriceModifier) ? (string)$this->PriceModifier : '0';
362 361
         $title = $this->Title;
363 362
         $title .= ($this->PriceModifier != 0) ?
364 363
             ': ('.self::getOptionModifierActionSymbol(
365 364
                 $this->PriceModifierAction,
366 365
                 $returnWithOnlyPlusMinus = true
367
-            ).'$'.$modPrice.')' :
368
-            '';
366
+            ).'$'.$modPrice.')' : '';
369 367
 
370 368
         return $title;
371 369
     }
Please login to merge, or discard this patch.
src/ORM/FoxyStripePageExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
         if ($config->EnableSidecart) {
20 20
             Requirements::javascript(
21
-                "https://cdn.foxycart.com/" . FoxyCart::getFoxyCartStoreName() . "/loader.js",
21
+                "https://cdn.foxycart.com/".FoxyCart::getFoxyCartStoreName()."/loader.js",
22 22
                 [
23 23
                     "async" => true,
24 24
                     "defer" => true,
Please login to merge, or discard this patch.