| @@ 258-269 (lines=12) @@ | ||
| 255 | /** |
|
| 256 | * @return bool|mixed |
|
| 257 | */ |
|
| 258 | public function getSubdomain() |
|
| 259 | { |
|
| 260 | $name = $this->getServerName(); |
|
| 261 | if ($name) { |
|
| 262 | if (substr_count($name, '.') > 1) { |
|
| 263 | $parts = explode('.', $name); |
|
| 264 | return reset($parts); |
|
| 265 | } |
|
| 266 | } |
|
| 267 | ||
| 268 | return false; |
|
| 269 | } |
|
| 270 | ||
| 271 | /** |
|
| 272 | * @return mixed |
|
| @@ 282-295 (lines=14) @@ | ||
| 279 | /** |
|
| 280 | * @return bool|mixed|string |
|
| 281 | */ |
|
| 282 | public function getRootDomain() |
|
| 283 | { |
|
| 284 | $name = $this->getServerName(); |
|
| 285 | if ($name) { |
|
| 286 | if (substr_count($name, '.') > 1) { |
|
| 287 | $parts = explode('.', $name); |
|
| 288 | array_shift($parts); |
|
| 289 | return implode('.', $parts); |
|
| 290 | } |
|
| 291 | return $name; |
|
| 292 | } |
|
| 293 | ||
| 294 | return false; |
|
| 295 | } |
|
| 296 | ||
| 297 | /* |
|
| 298 | * Returns the prefix as encoded in the string when the string starts with |
|