Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public function getMobileDeviceType()
{
//get the detector
$detect = new \Detection\MobileDetect();
$type = false;
if ($detect->isMobile()) {
$type = "phone";
if ($detect->isTablet()) {
$type = "tablet";
}
}
//return phone
return $type;
}
public function getConfig()
{
$config = array();
$configFiles = array();
if ($this->getMobileDeviceType() == 'phone') {
$configFiles[] = __DIR__ . '/config/all.config.php';
$configFiles[] = __DIR__ . '/config/phone.config.php';
}
if ($this->getMobileDeviceType() == 'tablet') {
$configFiles[] = __DIR__ . '/config/all.config.php';
$configFiles[] = __DIR__ . '/config/tablet.config.php';
}
foreach($configFiles as $configFile) {
$config = \Zend\Stdlib\ArrayUtils::merge($config, include $configFile);
}
return $config;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment