1 | <?php |
||
11 | class CountryURLProvider extends Object implements CountryURLProviderInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | private static $locale_get_parameter = 'ecomlocale'; |
||
17 | |||
18 | /** |
||
19 | * returns the selected country code if there is one ... |
||
20 | * as an uppercase code, e.g. NZ |
||
21 | * @param string|null $url |
||
22 | * |
||
23 | * @return bool |
||
24 | */ |
||
25 | public function hasCountrySegment($url = '') |
||
29 | |||
30 | /** |
||
31 | * returns the selected country code if there is onCurrentCountrySegmente ... |
||
32 | * as an uppercase code, e.g. NZ |
||
33 | * @param string|null $url |
||
34 | * @param bool $includeGetVariable |
||
35 | * |
||
36 | * @return string|null |
||
37 | */ |
||
38 | public function CurrentCountrySegment($url = '', $includeGetVariable = true) |
||
64 | |||
65 | |||
66 | /** |
||
67 | * replaces a country code in a URL with another one |
||
68 | * |
||
69 | * @param string $newCountryCode e.g. NZ / nz |
||
70 | * @param string $url |
||
71 | * |
||
72 | * @return string|null only returns a string if it is different from the original! |
||
73 | */ |
||
74 | public function replaceCountryCodeInUrl($newCountryCode, $url = '') |
||
111 | |||
112 | /** |
||
113 | * |
||
114 | * @param string|null $url can be a relative one or nothing at all ... |
||
115 | * |
||
116 | * @return string full URL currently being called. |
||
117 | */ |
||
118 | public function getCurrentURL($url = '') |
||
133 | } |
||
134 |
This check looks for type mismatches where the missing type is
false
. This is usually indicative of an error condtion.Consider the follow example
This function either returns a new
DateTime
object or false, if there was an error. This is a typical pattern in PHP programming to show that an error has occurred without raising an exception. The calling code should check for this returnedfalse
before passing on the value to another function or method that may not be able to handle afalse
.