Passed
Push — master ( 6ad167...7ec5ba )
by Matthew
03:25
created
src/Model/FoxyCart.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             if ($config->RemoteDomain) {
76 76
                 return $config->RemoteDomain;
77 77
             }
78
-        } else {
78
+        }else {
79 79
             if ($config->StoreName) {
80 80
                 return $config->StoreName;
81 81
             }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $config = FoxyStripeSetting::current_foxystripe_setting();
94 94
         if ($config->CustomSSL) {
95 95
             return sprintf('https://%s/cart', self::getFoxyCartStoreName());
96
-        } else {
96
+        }else {
97 97
             return sprintf('https://%s.foxycart.com/cart', self::getFoxyCartStoreName());
98 98
         }
99 99
     }
Please login to merge, or discard this patch.
src/Form/FoxyStripePurchaseForm.php 1 patch
Spacing   +8 added lines, -11 removed lines patch added patch discarded remove patch
@@ -117,12 +117,10 @@  discard block
 block discarded – undo
117 117
         $this->setSiteConfig($siteConfig);
118 118
 
119 119
         $fields = ($fields != null && $fields->exists()) ?
120
-            $this->getProductFields($fields) :
121
-            $this->getProductFields(FieldList::create());
120
+            $this->getProductFields($fields) : $this->getProductFields(FieldList::create());
122 121
 
123 122
         $actions = ($actions != null && $actions->exists()) ?
124
-            $this->getProductActions($actions) :
125
-            $this->getProductActions(FieldList::create());
123
+            $this->getProductActions($actions) : $this->getProductActions(FieldList::create());
126 124
         $validator = (!empty($validator) || $validator != null) ? $validator : RequiredFields::create();
127 125
 
128 126
         parent::__construct($controller, $name, $fields, $actions, $validator);
@@ -131,7 +129,7 @@  discard block
 block discarded – undo
131 129
         $this->setAttribute('action', FoxyCart::FormActionURL());
132 130
         $this->disableSecurityToken();
133 131
 
134
-        $this->setHTMLID($this->getTemplateHelper()->generateFormID($this) . "_{$product->ID}");
132
+        $this->setHTMLID($this->getTemplateHelper()->generateFormID($this)."_{$product->ID}");
135 133
     }
136 134
 
137 135
     /**
@@ -143,8 +141,7 @@  discard block
 block discarded – undo
143 141
     {
144 142
         //Requirements::javascript('dynamic/foxystripe: client/dist/javascript/scripts.min.js');
145 143
         $hiddenTitle = ($this->product->ReceiptTitle) ?
146
-            htmlspecialchars($this->product->ReceiptTitle) :
147
-            htmlspecialchars($this->product->Title);
144
+            htmlspecialchars($this->product->ReceiptTitle) : htmlspecialchars($this->product->Title);
148 145
         $code = $this->product->Code;
149 146
 
150 147
         if ($this->product->Available) {
@@ -172,7 +169,7 @@  discard block
 block discarded – undo
172 169
                 $code,
173 170
                 'price',
174 171
                 $this->product->Price
175
-            ))->setValue($this->product->Price));//can't override id
172
+            ))->setValue($this->product->Price)); //can't override id
176 173
             $fields->push(HiddenField::create(ProductPage::getGeneratedValue(
177 174
                 $code,
178 175
                 'weight',
@@ -212,7 +209,7 @@  discard block
 block discarded – undo
212 209
             );
213 210
 
214 211
             $fields->push(
215
-                HeaderField::create('submitPrice', '$' . $this->product->Price, 4)
212
+                HeaderField::create('submitPrice', '$'.$this->product->Price, 4)
216 213
                     ->addExtraClass('submit-price')
217 214
             );
218 215
             $fields->push(
@@ -221,7 +218,7 @@  discard block
 block discarded – undo
221 218
             );
222 219
 
223 220
             $this->extend('updatePurchaseFormFields', $fields);
224
-        } else {
221
+        }else {
225 222
             $fields->push(HeaderField::create('submitPrice', 'Currently Out of Stock', 4));
226 223
         }
227 224
 
@@ -267,7 +264,7 @@  discard block
 block discarded – undo
267 264
      */
268 265
     protected function getProductOptionSet()
269 266
     {
270
-        $assignAvailable = function ($self) {
267
+        $assignAvailable = function($self) {
271 268
             /** @var OptionItem $self */
272 269
             $this->extend('updateFoxyStripePurchaseForm', $form);
273 270
             $self->Available = ($self->getAvailability()) ? true : false;
Please login to merge, or discard this patch.
src/Controller/FoxyStripeController.php 1 patch
Spacing   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
         // handle POST from FoxyCart API transaction
44 44
         if ((isset($_POST['FoxyData']) or isset($_POST['FoxySubscriptionData']))) {
45 45
             $FoxyData_encrypted = (isset($_POST['FoxyData'])) ?
46
-                urldecode($_POST['FoxyData']) :
47
-                urldecode($_POST['FoxySubscriptionData']);
46
+                urldecode($_POST['FoxyData']) : urldecode($_POST['FoxySubscriptionData']);
48 47
             $FoxyData_decrypted = \rc4crypt::decrypt(FoxyCart::getStoreKey(), $FoxyData_encrypted);
49 48
 
50 49
             // parse the response and save the order
@@ -54,7 +53,7 @@  discard block
 block discarded – undo
54 53
             $this->extend('addIntegrations', $FoxyData_encrypted);
55 54
 
56 55
             return 'foxy';
57
-        } else {
56
+        }else {
58 57
             return 'No FoxyData or FoxySubscriptionData received.';
59 58
         }
60 59
     }
@@ -138,7 +137,7 @@  discard block
 block discarded – undo
138 137
                 /* todo: make sure local password is updated if changed on FoxyCart
139 138
                 $this->updatePasswordFromData($customer, $order);
140 139
                 */
141
-            } else {
140
+            }else {
142 141
                 // create new Member, set password info from FoxyCart
143 142
                 $customer = Member::create();
144 143
                 $customer->Customer_ID = (int)$order->customer_id;
@@ -236,7 +235,7 @@  discard block
 block discarded – undo
236 235
             }
237 236
 
238 237
             return ProductPage::get()
239
-                ->filter('ID', (int) $productOptions->product_option_value)
238
+                ->filter('ID', (int)$productOptions->product_option_value)
240 239
                 ->First();
241 240
         }
242 241
     }
@@ -286,18 +285,18 @@  discard block
 block discarded – undo
286 285
         // to do: consider a login/registration form here if not logged in
287 286
         if ($Member = Security::getCurrentUser()) {
288 287
             $Member = Security::getCurrentUser();
289
-        } else {
288
+        }else {
290 289
             $Member = new Member();
291 290
             $Member->Customer_ID = 0;
292 291
         }
293 292
 
294
-        $auth_token = sha1($Member->Customer_ID . '|' . $timestampNew . '|' . FoxyCart::getStoreKey());
293
+        $auth_token = sha1($Member->Customer_ID.'|'.$timestampNew.'|'.FoxyCart::getStoreKey());
295 294
 
296 295
         $config = FoxyStripeSetting::current_foxystripe_setting();
297 296
         if ($config->CustomSSL) {
298 297
             $link = FoxyCart::getFoxyCartStoreName();
299
-        } else {
300
-            $link = FoxyCart::getFoxyCartStoreName() . '.foxycart.com';
298
+        }else {
299
+            $link = FoxyCart::getFoxyCartStoreName().'.foxycart.com';
301 300
         }
302 301
 
303 302
         $redirect_complete = 'https://'.$link.'/checkout?fc_auth_token='.$auth_token.'&fcsid='.$fcsid.
Please login to merge, or discard this patch.
src/Page/ProductPage.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
      */
227 227
     public function getCMSFields()
228 228
     {
229
-        $this->beforeUpdateCMSFields(function (FieldList $fields) {
229
+        $this->beforeUpdateCMSFields(function(FieldList $fields) {
230 230
             // Cateogry Dropdown field w/ add new
231
-            $source = function () {
231
+            $source = function() {
232 232
                 return ProductCategory::get()->map()->toArray();
233 233
             };
234 234
             $catField = DropdownField::create('CategoryID', _t('ProductPage.Category', 'FoxyCart Category'), $source())
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
             $product = self::get()->byID($this->ID);
369 369
             if (isset($product->ParentID)) {
370 370
                 $origParent = $product->ParentID;
371
-            } else {
371
+            }else {
372 372
                 $origParent = null;
373 373
             }
374 374
             $currentParent = $this->ParentID;
@@ -448,8 +448,7 @@  discard block
 block discarded – undo
448 448
         $optionName = ($optionName !== null) ? preg_replace('/\s/', '_', $optionName) : $optionName;
449 449
 
450 450
         return (FoxyStripeSetting::current_foxystripe_setting()->CartValidation)
451
-            ? \FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) :
452
-            $optionValue;
451
+            ? \FoxyCart_Helper::fc_hash_value($productCode, $optionName, $optionValue, $method, $output, $urlEncode) : $optionValue;
453 452
     }
454 453
 
455 454
     /**
Please login to merge, or discard this patch.
src/Controller/DataTestController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $rules = Director::config()->get('rules');
37 37
         $rule = array_search(FoxyStripeController::class, $rules);
38
-        $myURL = Director::absoluteBaseURL() . explode('//', $rule)[0];
38
+        $myURL = Director::absoluteBaseURL().explode('//', $rule)[0];
39 39
         $myKey = FoxyCart::getStoreKey();
40 40
 
41 41
         $this->updateConfig();
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             $email = $emails[count($emails) - 1];
123 123
             return preg_replace_callback(
124 124
                 "|(\d+)|",
125
-                function ($mathces) {
125
+                function($mathces) {
126 126
                     return ++$mathces[1];
127 127
                 },
128 128
                 $email
Please login to merge, or discard this patch.