Completed
Push — master ( 291a36...004164 )
by Nicolaas
02:23
created
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.