These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * this is a very basic class with as its sole purpose providing |
||
5 | * the country of the customer. |
||
6 | * By default we are using the GEOIP class |
||
7 | * but you can switch it to your own system by changing |
||
8 | * the classname in the ecommerce.yml config file. |
||
9 | */ |
||
10 | class EcommerceCountry_VisitorCountryProvider extends Object implements EcommerceGEOipProvider |
||
0 ignored issues
–
show
|
|||
11 | { |
||
12 | /** |
||
13 | * @return string (Country Code - e.g. NZ, AU, or AF) |
||
14 | */ |
||
15 | public function getCountry() |
||
16 | { |
||
17 | if (class_exists('Geoip')) { |
||
18 | return Geoip::visitor_country(); |
||
19 | } else { |
||
20 | return Config::inst()->get('EcommerceCountry', 'default_country_code'); |
||
21 | } |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * returns string of IP address. |
||
26 | */ |
||
27 | public function getIP() |
||
28 | { |
||
29 | return Controller::curr()->getRequest()->getIP(); |
||
30 | } |
||
31 | } |
||
32 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.