Example #1
0
 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;
 }
Example #2
0
use Jenssegers\Agent\Agent;
use Linker\Config\ConfigBlock;
use Linker\Config\FileConfig;
use Linker\Redirect;
use Linker\User;
define('ROOT', dirname(__DIR__));
include ROOT . '/vendor/autoload.php';
try {
    $config = (new FileConfig(url()))->get();
} catch (Exception $e) {
    exit("File does not exists");
}
$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>
Example #3
0
 public function testPlatform()
 {
     $this->assertEquals('mobile', $this->user->getPlatform());
 }