Passed
Push — master ( 4ebc9d...305f3a )
by Nicolaas
02:38
created
code/control/CountryPrice_Page_Controller_Extension.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@
 block discarded – undo
157 157
 
158 158
     /**
159 159
      *
160
-     * @return DataList
160
+     * @return string
161 161
      */
162 162
     public function AlternativeHrefLangLinksCachingKey()
163 163
     {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@
 block discarded – undo
101 101
         $hasCountrySegment = CountryPrice_Translation::get_country_url_provider()->hasCountrySegment($oldURL);
102 102
         if($hasCountrySegment){
103 103
             $newURL = CountryPrice_Translation::get_country_url_provider()->replaceCountryCodeInUrl($countryCode, $oldURL);
104
-        }
105
-        else {
104
+        } else {
106 105
             $newURL = CountryPrice_Translation::get_country_url_provider()->addCountryCodeToUrl($countryCode, $oldURL);
107 106
         }
108 107
         if ($oldURL !== $newURL && self::$_redirection_count < 3) {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@  discard block
 block discarded – undo
28 28
         //provided by stealth ...
29 29
         $param = Config::inst()->get('CountryPrice_Translation', 'locale_get_parameter');
30 30
         $countryObject = CountryPrice_EcommerceCountry::get_real_country();
31
-        if($countryObject && $countryObject->Code) {
31
+        if ($countryObject && $countryObject->Code) {
32 32
             $oldCountryCode = strtoupper($countryObject->Code);
33 33
         } else {
34 34
             $oldCountryCode = 'XX';
35 35
         }
36 36
         if (isset($_GET[$param])) {
37 37
             $urlCountryCode = preg_replace("/[^A-Z]+/", "", strtoupper(Convert::raw2sql($_GET[$param])));
38
-            if($countryCode) {
38
+            if ($countryCode) {
39 39
                 if ($oldCountryCode !== $urlCountryCode) {
40 40
                     $countryObject = DataObject::get_one('EcommerceCountry', ['Code' => $urlCountryCode]);
41
-                    if($countryObject) {
41
+                    if ($countryObject) {
42 42
                         //change country Object
43 43
                         //reset everything ...
44 44
                         CountryPrices_ChangeCountryController::set_new_country($urlCountryCode);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 }
49 49
             }
50 50
         }
51
-        if($countryObject) {
51
+        if ($countryObject) {
52 52
 
53 53
             //check if a redirect is required ...
54 54
             $this->checkForOffsiteRedirects($countryObject);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $oldURL = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
115 115
 
116 116
         $hasCountrySegment = CountryPrice_Translation::get_country_url_provider()->hasCountrySegment($oldURL);
117
-        if($hasCountrySegment){
117
+        if ($hasCountrySegment) {
118 118
             $newURL = CountryPrice_Translation::get_country_url_provider()->replaceCountryCodeInUrl($countryCode, $oldURL);
119 119
         }
120 120
         else {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     public function AlternativeHrefLangLinksCachingKey()
170 170
     {
171 171
         $countryObject = CountryPrice_EcommerceCountry::get_real_country();
172
-        if($countryObject && $countryObject->Code) {
172
+        if ($countryObject && $countryObject->Code) {
173 173
             return 'AlternativeHrefLangLinksCachingKey-'.$countryObject->Code.'-'.$this->owner->dataRecord->ID.'-'.strtotime($this->owner->dataRecord->LastEdited);
174 174
         }
175 175
         return 'AlternativeHrefLangLinksCachingKey'.$this->owner->dataRecord->ID.'-'.$this->owner->dataRecord->ID.'-'.strtotime($this->owner->dataRecord->LastEdited);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     public function UpdateCanonicalLink(&$link)
183 183
     {
184 184
         $obj = $this->owner->dataRecord->CanonicalObject();
185
-        if($obj) {
185
+        if ($obj) {
186 186
             $link = $obj->Link();
187 187
         } else {
188 188
             $link = $this->owner->dataRecord->AbsoluteLink();
Please login to merge, or discard this patch.
code/model/money/CountryPrice_EcommerceCurrency.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
             $currencyCode = isset($currencyPerCountry[$countryCode]) ? $currencyPerCountry[$countryCode] : EcommerceCurrency::default_currency_code();
45 45
             $currencyDO = EcommerceCurrency::get_one_from_code($currencyCode);
46 46
         }
47
-        if (! $currencyDO) {
47
+        if (!$currencyDO) {
48 48
             $currencyDO = EcommerceCurrency::create_new($currencyCode);
49 49
         }
50
-        if (! $currencyDO) {
50
+        if (!$currencyDO) {
51 51
             $currencyDO = EcommerceCurrency::get_default();
52 52
         }
53 53
         return $currencyDO;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $cachekey = "EcommerceCurrencyCountryMatrix";
69 69
         $cache = SS_Cache::factory('CountryPrice_EcommerceCurrency');
70
-        if (! ($serializedArray = $cache->load($cachekey))) {
70
+        if (!($serializedArray = $cache->load($cachekey))) {
71 71
             $countries = CountryPrice_EcommerceCountry::get_real_countries_list();
72 72
             $unserializedArray = array();
73 73
             $defaultCurrencyCode = EcommerceCurrency::default_currency_code();
Please login to merge, or discard this patch.
code/model/translations/CountryPrice_SiteTreeExtensions.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -123,6 +123,7 @@
 block discarded – undo
123 123
     /**
124 124
      * @var int $countryID
125 125
      *
126
+     * @param integer $countryID
126 127
      * @return CountryPrice_Translation | null
127 128
      */
128 129
     public function getEcommerceTranslation($countryID)
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
     public function CanonicalObject()
49 49
     {
50 50
         $countryObject = CountryPrice_EcommerceCountry::get_real_country();
51
-        if($countryObject && $countryObject->Code) {
51
+        if ($countryObject && $countryObject->Code) {
52 52
             $object = $this->owner->CountryPriceTranslations()
53 53
                 ->innerJoin('EcommerceCountry', '"EcommerceCountry"."ID" = "CountryPrice_Translation"."EcommerceCountryID"')
54 54
                 ->filter(array('EcommerceCountry.Code' => $countryObject->Code))
55 55
                 ->first();
56
-            if($object && $object->exists()) {
56
+            if ($object && $object->exists()) {
57 57
                 return $object;
58 58
             }
59 59
         }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function loadTranslatedValues($countryID = 0, $variableOrMethod = '')
64 64
     {
65 65
         $translation = null;
66
-        if (! $countryID) {
66
+        if (!$countryID) {
67 67
             $countryObject = CountryPrice_EcommerceCountry::get_real_country();
68 68
             if ($countryObject) {
69 69
                 $countryID = $countryObject->ID;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
             $fieldsToReplace = $translation->FieldsToReplace();
83 83
             foreach ($fieldsToReplace as $replaceFields) {
84 84
                 $pageField = $replaceFields->PageField;
85
-                $pageFieldTranslated = $pageField . 'Translated';
85
+                $pageFieldTranslated = $pageField.'Translated';
86 86
                 $translationField = $replaceFields->TranslationField;
87
-                if (! $variableOrMethod || $variableOrMethod === $pageField) {
87
+                if (!$variableOrMethod || $variableOrMethod === $pageField) {
88 88
                     if ($translation->hasMethod($translationField)) {
89 89
                         $this->owner->$pageField = $translation->$translationField();
90 90
                         $this->owner->$pageFieldTranslated = $translation->$translationField();
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function getEcommerceTranslation($countryID)
149 149
     {
150
-        if(!isset($this->_translations_all_cache[$countryID])) {
150
+        if (!isset($this->_translations_all_cache[$countryID])) {
151 151
             $this->_translations_all_cache[$countryID] = $this->owner
152 152
                 ->CountryPriceTranslations()
153 153
                 ->filter(
Please login to merge, or discard this patch.
code/interfaces/CountryURLProviderInterface.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -3,14 +3,17 @@
 block discarded – undo
3 3
 interface CountryURLProviderInterface
4 4
 {
5 5
     /**
6
+     * @return boolean
6 7
      */
7 8
     public function hasCountrySegment($url = '');
8 9
 
9 10
     /**
11
+     * @return string
10 12
      */
11 13
     public function replaceCountryCodeInUrl($countryCode, $url = '');
12 14
 
13 15
     /**
16
+     * @return string
14 17
      */
15 18
     public function addCountryCodeToUrl($countryCode, $url = '');
16 19
 
Please login to merge, or discard this patch.
code/model/translations/CountryPrice_Translation.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -225,8 +225,7 @@
 block discarded – undo
225 225
             $hasCountrySegment = CountryPrice_Translation::get_country_url_provider()->hasCountrySegment($link);
226 226
             if($hasCountrySegment){
227 227
                 $link = CountryPrice_Translation::get_country_url_provider()->replaceCountryCodeInUrl($this->EcommerceCountry()->Code, $link);
228
-            }
229
-            else {
228
+            } else {
230 229
                 $link = CountryPrice_Translation::get_country_url_provider()->addCountryCodeToUrl($this->EcommerceCountry()->Code, $link);
231 230
             }
232 231
         }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
         $countryDropdownField = DropdownField::create(
100 100
             'EcommerceCountryID',
101 101
             $fields->dataFieldByName('EcommerceCountryID')->Title(),
102
-            array('' => '-- make sure to select a country --')+$countries
102
+            array('' => '-- make sure to select a country --') + $countries
103 103
         );
104 104
 
105 105
         // //$fields->removeFieldFromTab("Root.Main", 'ParentID');
106
-        if($this->WithoutTranslation) {
106
+        if ($this->WithoutTranslation) {
107 107
             return FieldList::create(
108 108
                 array(
109 109
                     $countryDropdownField,
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
             );
124 124
         }
125 125
         $dbFields = $this->inheritedDatabaseFields();
126
-        foreach($dbFields as $dbField => $fieldType) {
126
+        foreach ($dbFields as $dbField => $fieldType) {
127 127
             $useField = 'UseOriginal'.$dbField;
128
-            if(!empty($this->$useField)) {
128
+            if (!empty($this->$useField)) {
129 129
                 $fields->replaceField(
130 130
                     $dbField,
131 131
                     $fields->dataFieldByName($dbField)->performReadonlyTransformation()
132 132
                 );
133 133
             }
134
-            if($fields->dataFieldByName($useField)){
135
-                $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use untranslated value for ') . $dbField);
134
+            if ($fields->dataFieldByName($useField)) {
135
+                $fields->dataFieldByName($useField)->setDescription(_t('CountryPrice_Translation.IGNORE', 'Use untranslated value for ').$dbField);
136 136
             }
137 137
         }
138
-        if($this->exists() && $this->ParentID) {
138
+        if ($this->exists() && $this->ParentID) {
139 139
             $fields->addFieldToTab(
140 140
                 'Root.ParentPage',
141 141
                 CMSEditLinkField::create(
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
             )
211 211
         );
212 212
         $this->extend('updateFieldsToReplace', $al);
213
-        foreach($al as $fieldToReplace) {
214
-            $ignoreField = 'UseOriginal' . $fieldToReplace->PageField;
215
-            if(!empty($this->owner->$ignoreField)) {
213
+        foreach ($al as $fieldToReplace) {
214
+            $ignoreField = 'UseOriginal'.$fieldToReplace->PageField;
215
+            if (!empty($this->owner->$ignoreField)) {
216 216
                 $al->remove($fieldToReplace);
217 217
             }
218 218
         }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         $link = $this->Parent()->Link();
236 236
         if ($this->EcommerceCountryID) {
237 237
             $hasCountrySegment = CountryPrice_Translation::get_country_url_provider()->hasCountrySegment($link);
238
-            if($hasCountrySegment){
238
+            if ($hasCountrySegment) {
239 239
                 $link = CountryPrice_Translation::get_country_url_provider()->replaceCountryCodeInUrl($this->EcommerceCountry()->Code, $link);
240 240
             }
241 241
             else {
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
         parent::requireDefaultRecords();
251 251
         //get rid of rogue entries:
252 252
         DB::query('DELETE FROM CountryPrice_Translation WHERE EcommerceCountryID = 0 OR ParentID = 0');
253
-        if(Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) {
253
+        if (Config::inst()->get('CountryPrice_Translation', 'automatically_create_dummy_translations_for_products_and_productgroups')) {
254 254
             $prices = CountryPrice::get();
255 255
             $ecommerceCountries = array();
256
-            foreach($prices as $price) {
257
-                if($countryObject = $price->CountryObject()) {
258
-                    if($buyable = $price->Buyable()) {
259
-                        if($buyable instanceof Product) {
260
-                            if($buyable->ID && $countryObject->ID) {
256
+            foreach ($prices as $price) {
257
+                if ($countryObject = $price->CountryObject()) {
258
+                    if ($buyable = $price->Buyable()) {
259
+                        if ($buyable instanceof Product) {
260
+                            if ($buyable->ID && $countryObject->ID) {
261 261
                                 $filter = array(
262 262
                                     'EcommerceCountryID' => $countryObject->ID,
263 263
                                     'ParentID' => $buyable->ID
264 264
                                 );
265 265
                                 $ecommerceCountries[$countryObject->ID] = $countryObject;
266
-                                if(! CountryPrice_Translation::get()->filter($filter)->first()) {
266
+                                if (!CountryPrice_Translation::get()->filter($filter)->first()) {
267 267
                                     DB::alteration_message(
268 268
                                         'Creating fake translation for '.$buyable->Title.' for country '.$countryObject->Code,
269 269
                                         'created'
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
                     }
278 278
                 }
279 279
             }
280
-            if(count($ecommerceCountries)) {
281
-                foreach(ProductGroup::get() as $productGroup) {
282
-                    foreach($ecommerceCountries as $countryID => $countryObject) {
280
+            if (count($ecommerceCountries)) {
281
+                foreach (ProductGroup::get() as $productGroup) {
282
+                    foreach ($ecommerceCountries as $countryID => $countryObject) {
283 283
                         $filter = array(
284 284
                             'EcommerceCountryID' => $countryObject->ID,
285 285
                             'ParentID' => $productGroup->ID
286 286
                         );
287
-                        if(! CountryPrice_Translation::get()->filter($filter)->first()) {
287
+                        if (!CountryPrice_Translation::get()->filter($filter)->first()) {
288 288
                             DB::alteration_message(
289 289
                                 'Creating fake translation for '.$productGroup->Title.' for country '.$countryObject->Code,
290 290
                                 'created'
Please login to merge, or discard this patch.
code/api/CountryURLProvider.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,62 +10,62 @@
 block discarded – undo
10 10
 
11 11
 class CountryURLProvider extends Object implements CountryURLProviderInterface
12 12
 {
13
-    private static $country_segments  = array('nz', 'au', 'gb', 'eu', 'jp', 'us', 'zz');
13
+    private static $country_segments = array('nz', 'au', 'gb', 'eu', 'jp', 'us', 'zz');
14 14
 
15
-    public function hasCountrySegment($url = ''){
15
+    public function hasCountrySegment($url = '') {
16 16
         $url = $this->getDefaultURL($url);
17 17
         $parsedUrl = parse_url($url);
18 18
         $pathSegments = explode("/", $parsedUrl['path']);
19 19
         $firstSegment = '';
20
-        $countries =  Config::inst()->get('CountryURLProvider', 'country_segments');
21
-        foreach ($pathSegments as $position => $segment){
22
-            if($segment){
20
+        $countries = Config::inst()->get('CountryURLProvider', 'country_segments');
21
+        foreach ($pathSegments as $position => $segment) {
22
+            if ($segment) {
23 23
                 $firstSegment = $segment;
24 24
                 break;
25 25
             }
26 26
         }
27
-        if(in_array($firstSegment, $countries)){
27
+        if (in_array($firstSegment, $countries)) {
28 28
             return true;
29 29
         }
30 30
         return false;
31 31
     }
32 32
 
33
-    public function replaceCountryCodeInUrl($countryCode, $url = ''){
33
+    public function replaceCountryCodeInUrl($countryCode, $url = '') {
34 34
         $url = $this->getDefaultURL($url);
35 35
         $parsedUrl = parse_url($url);
36 36
         $pathParts = explode('/', $parsedUrl['path']);
37
-        $countries =  Config::inst()->get('CountryURLProvider', 'country_segments');
38
-        foreach($pathParts as $pathPartsKey => $pathPart) {
37
+        $countries = Config::inst()->get('CountryURLProvider', 'country_segments');
38
+        foreach ($pathParts as $pathPartsKey => $pathPart) {
39 39
             //check for first match
40
-            if(in_array($pathPart, $countries)) {
40
+            if (in_array($pathPart, $countries)) {
41 41
                 $pathParts[$pathPartsKey] = strtolower($countryCode);
42 42
                 break;
43 43
             }
44 44
         }
45 45
         $parsedUrl['path'] = implode('/', $pathParts);
46
-        $url = $parsedUrl['scheme']. '://'. $parsedUrl['host']. $parsedUrl['path'];
47
-        if(isset($parsedUrl['query'])){
48
-            $url = $url . $parsedUrl['query'];
46
+        $url = $parsedUrl['scheme'].'://'.$parsedUrl['host'].$parsedUrl['path'];
47
+        if (isset($parsedUrl['query'])) {
48
+            $url = $url.$parsedUrl['query'];
49 49
         }
50 50
         return $url;
51 51
     }
52 52
 
53
-    public function addCountryCodeToUrl($countryCode, $url = ''){
53
+    public function addCountryCodeToUrl($countryCode, $url = '') {
54 54
         $url = $this->getDefaultURL($url);
55 55
         $parsedUrl = parse_url($url);
56
-        $url = $parsedUrl['scheme']. '://'. $parsedUrl['host']. '/'. strtolower($countryCode) . $parsedUrl['path'];
57
-        if(isset($parsedUrl['query'])){
58
-            $url = $url . $parsedUrl['query'];
56
+        $url = $parsedUrl['scheme'].'://'.$parsedUrl['host'].'/'.strtolower($countryCode).$parsedUrl['path'];
57
+        if (isset($parsedUrl['query'])) {
58
+            $url = $url.$parsedUrl['query'];
59 59
         }
60 60
         return $url;
61 61
     }
62 62
 
63 63
     private function getDefaultURL($url = '')
64 64
     {
65
-        if($url) {
65
+        if ($url) {
66 66
             return Director::absoluteURL($url);
67 67
         }
68
-        return (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
68
+        return (isset($_SERVER['HTTPS']) ? "https" : "http")."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
69 69
     }
70 70
 
71 71
 }
Please login to merge, or discard this patch.
code/model/buyables/CountryPrice_BuyableExtension.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
     /**
100 100
      * This is called from /ecommerce/code/Product
101 101
      * returning NULL is like returning TRUE OR FALSE, i.e. ignore this.
102
-     * @param Member (optional)   $member
102
+     * @param Member Member   $member
103 103
      * @param bool (optional)     $checkPrice
104
-     * @return false | null
104
+     * @return null|false | null
105 105
      */
106 106
     public function canPurchaseByCountry(Member $member = null, $checkPrice = true, $countryCode = '')
107 107
     {
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
      * as long as we do not give distributors access to the Products
400 400
      * this is fairly safe.
401 401
      * @param member (optiona) $member
402
-     * @return null / bool
402
+     * @return boolean / bool
403 403
      */
404 404
     public function canEdit($member = null)
405 405
     {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
     {
108 108
         $countryObject = CountryPrice_EcommerceCountry::get_real_country($countryCode);
109 109
         if ($countryObject) {
110
-            if ($this->debug) {debug::log('found country object: '.$countryObject->Code);}
110
+            if ($this->debug) {debug::log('found country object: '.$countryObject->Code); }
111 111
             $countryCode = $countryObject->Code;
112 112
         }
113 113
         if ($countryCode == '') {
114
-            if ($this->debug) {debug::log('There is no country Code! ');}
114
+            if ($this->debug) {debug::log('There is no country Code! '); }
115 115
 
116 116
             //we can not decide
117 117
             return null;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             //easy  ... overrules all ...
122 122
             if ($this->owner->AllCountries) {
123 123
                 //is there a valid price ???
124
-                if ($this->debug) {debug::log('All countries applies - updated  ... new price = '.floatval($this->owner->updateCalculatedPrice()));}
124
+                if ($this->debug) {debug::log('All countries applies - updated  ... new price = '.floatval($this->owner->updateCalculatedPrice())); }
125 125
                 $canSell = true;
126 126
             } else {
127 127
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                 //excluded first...
130 130
                 $excluded = $this->owner->getManyManyComponents('ExcludedCountries', "\"Code\" = '$countryCode'")->Count();
131 131
                 if ($excluded) {
132
-                    if ($this->debug) {debug::log('excluded country');}
132
+                    if ($this->debug) {debug::log('excluded country'); }
133 133
 
134 134
                     //no!
135 135
                     return false;
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
 
138 138
                 //default country is included by default ...
139 139
                 if ($countryCode == EcommerceConfig::get('EcommerceCountry', 'default_country_code')) {
140
-                    if ($this->debug) {debug::log('we are in the default country! exiting now ... ');}
140
+                    if ($this->debug) {debug::log('we are in the default country! exiting now ... '); }
141 141
                     $canSell = true;
142
-                } elseif($this->owner->IncludedCountries()->count()) {
142
+                } elseif ($this->owner->IncludedCountries()->count()) {
143 143
                     $included = $this->owner->getManyManyComponents('IncludedCountries', "\"Code\" = '$countryCode'")->Count();
144 144
                     if ($included) {
145
-                        if ($this->debug) {debug::log('In included countries');}
145
+                        if ($this->debug) {debug::log('In included countries'); }
146 146
                         //null basically means - ignore ...
147 147
                         $canSell = true;
148 148
                     } else {
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
                     }
152 152
                 }
153 153
             }
154
-            if ($this->debug) {debug::log('the product is '.($canSell ? '' : 'NOT ').' for sale - lets check price ... ');}
154
+            if ($this->debug) {debug::log('the product is '.($canSell ? '' : 'NOT ').' for sale - lets check price ... '); }
155 155
 
156 156
             //is there a valid price ???
157 157
             $countryPrice = $this->owner->getCalculatedPrice();
158
-            if ($this->debug) {debug::log('nothing applies, but we have a country price... '.$countryPrice);}
158
+            if ($this->debug) {debug::log('nothing applies, but we have a country price... '.$countryPrice); }
159 159
 
160 160
             return floatval($countryPrice) > 0 ? null : false;
161 161
         }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             return null;
219 219
         }
220 220
         $key = $this->owner->ClassName."___".$this->owner->ID.'____'.$countryCode;
221
-        if (! isset(self::$_buyable_price[$key])) {
221
+        if (!isset(self::$_buyable_price[$key])) {
222 222
             //basics
223 223
             $currency = null;
224 224
             $currencyCode = null;
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                 }
307 307
             }
308 308
             //order must have a country and a currency
309
-            if (! $currencyCode ||  ! $countryCode) {
309
+            if (!$currencyCode || !$countryCode) {
310 310
                 if ($this->debug) {
311 311
                     debug::log('No currency ('.$currencyCode.') or no country code ('.$countryCode.') for order: ');
312 312
                 }
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
      */
404 404
     public function canEdit($member = null)
405 405
     {
406
-        if (! $member) {
406
+        if (!$member) {
407 407
             $member = Member::currentUser();
408 408
         }
409 409
         if ($member) {
Please login to merge, or discard this patch.
code/control/CountryPrice_ChangeCountryController.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -120,8 +120,7 @@
 block discarded – undo
120 120
             $hasCountrySegment = CountryPrice_Translation::get_country_url_provider()->hasCountrySegment($url);
121 121
             if($hasCountrySegment){
122 122
                 $url = CountryPrice_Translation::get_country_url_provider()->replaceCountryCodeInUrl($newCountryCode, $url);
123
-            }
124
-            else {
123
+            } else {
125 124
                 $url = CountryPrice_Translation::get_country_url_provider()->addCountryCodeToUrl($newCountryCode, $url);
126 125
             }
127 126
             return $url.$query;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 
85 85
         //redirect now
86 86
         $param = Config::inst()->get('CountryPrice_Translation', 'locale_get_parameter');
87
-        if(isset($_GET['force']) && $_GET['force']) {
87
+        if (isset($_GET['force']) && $_GET['force']) {
88 88
 
89
-            return $this->redirect(self::$url_segment . '/changeto/' .$newCountryCode . '/'. '?force-back-home');
89
+            return $this->redirect(self::$url_segment.'/changeto/'.$newCountryCode.'/'.'?force-back-home');
90 90
         }
91
-        if(isset($_GET['force-back-home']) || $_GET['force-back-home']) {
91
+        if (isset($_GET['force-back-home']) || $_GET['force-back-home']) {
92 92
 
93 93
             return $this->redirect('/');
94 94
         }
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 
150 150
             $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : '';
151 151
 
152
-            $query = !empty($query) ? '?'. http_build_query($query) : '';
152
+            $query = !empty($query) ? '?'.http_build_query($query) : '';
153 153
 
154 154
             $hasCountrySegment = CountryPrice_Translation::get_country_url_provider()->hasCountrySegment($url);
155
-            if($hasCountrySegment){
155
+            if ($hasCountrySegment) {
156 156
                 $url = CountryPrice_Translation::get_country_url_provider()->replaceCountryCodeInUrl($newCountryCode, $url);
157 157
             }
158 158
             else {
Please login to merge, or discard this patch.