public function getUrl() { do { $url = $this->configBlock->getUrl(); $configOS = $this->configBlock->getOS(); if ($configOS && $configOS != $this->user->getOS()) { continue; } $configLocale = $this->configBlock->getLocale(); if ($configLocale != $this->user->getLocale()) { continue; } $configPlatform = $this->configBlock->getPlatform(); if ($configPlatform && $configPlatform != $this->user->getPlatform()) { continue; } break; } while ($this->configBlock = $this->configBlock->child()); return $url; }
$configBlock = new ConfigBlock($config); $agent = new Agent(); $user = new User($agent); $redirect = new Redirect($configBlock, $user); ?> locale: <?php echo $user->getLocale(); ?> <br> platform: <?php echo $user->getPlatform(); ?> <br> os: <?php echo $user->getOS(); ?> <br> locales: <pre><?php echo print_r($agent->languages()); ?> </pre> url to redirect: <?php echo $redirect->getUrl(); ?> <br> <pre> <?php
public function testOS() { $this->assertEquals('android', $this->user->getOS()); }