-
-
Notifications
You must be signed in to change notification settings - Fork 580
/
MobApp.class.php
39 lines (33 loc) · 997 Bytes
/
MobApp.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* @title Mobile App class for iOS/Android apps.
*
* @author Pierre-Henry Soria <[email protected]>
* @copyright (c) 2015-2019, Pierre-Henry Soria. All Rights Reserved.
* @license MIT License; See LICENSE.md and COPYRIGHT.md in the root directory.
* @package PH7 / Framework / Mobile
*/
namespace PH7\Framework\Mobile;
defined('PH7') or exit('Restricted access');
use PH7\Framework\Mvc\Request\Http;
use PH7\Framework\Session\Session;
class MobApp
{
// Request name used in mobile apps
const VAR_NAME = 'mobapp';
/**
* Check if a mobile native app called the site.
*
* @param Http $oHttp
* @param Session $oSession
*
* @return bool
*/
final public static function is(Http $oHttp, Session $oSession)
{
if ($oHttp->getExists(static::VAR_NAME)) {
$oSession->set(static::VAR_NAME, 1);
}
return $oSession->exists(static::VAR_NAME);
}
}