1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Unicodeveloper\Identify; |
4
|
|
|
|
5
|
|
|
use Sinergi\BrowserDetector\{ Os, Device, Browser, Language }; |
6
|
|
|
|
7
|
|
|
class Identify { |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Store the os object |
11
|
|
|
* @var object |
12
|
|
|
*/ |
13
|
|
|
protected $os; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Store the device object |
17
|
|
|
* @var object |
18
|
|
|
*/ |
19
|
|
|
protected $device; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Store the browser object |
23
|
|
|
* @var object |
24
|
|
|
*/ |
25
|
|
|
protected $browser; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Store the language object |
29
|
|
|
* @var object |
30
|
|
|
*/ |
31
|
|
|
protected $language; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Store the mobile object |
35
|
|
|
* @var object |
36
|
|
|
*/ |
37
|
|
|
protected $mobile; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Create an Instance of Browser and Os |
41
|
|
|
*/ |
42
|
|
|
public function __construct() |
43
|
|
|
{ |
44
|
|
|
$this->os = new Os(); |
45
|
|
|
$this->device = new Device(); |
46
|
|
|
$this->browser = new Browser(); |
47
|
|
|
$this->language = new Language(); |
48
|
|
|
$this->mobile = new \Mobile_Detect(); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Get all the methods applicable to Os detection |
53
|
|
|
* e.g getName(), getVersion() |
54
|
|
|
* @return \Sinergi\BrowserDetector\Os |
55
|
|
|
*/ |
56
|
|
|
public function os() : Os |
57
|
|
|
{ |
58
|
|
|
return $this->os; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Get all the methods applicable to Device detection |
63
|
|
|
* e.g getName() |
64
|
|
|
* @return \Sinergi\BrowserDetector\Device |
65
|
|
|
*/ |
66
|
|
|
public function device() : Device |
67
|
|
|
{ |
68
|
|
|
return $this->device; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Get all the methods applicable to Browser detection |
73
|
|
|
* e.g getName(), getVersion() |
74
|
|
|
* @return \Sinergi\BrowserDetector\Browser |
75
|
|
|
*/ |
76
|
|
|
public function browser() : Browser |
77
|
|
|
{ |
78
|
|
|
return $this->browser; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Get all the methods applicable to Language detection |
83
|
|
|
* e.g getLanguage() |
84
|
|
|
* @return \Sinergi\BrowserDetector\Language |
85
|
|
|
*/ |
86
|
|
|
public function lang() : Language |
87
|
|
|
{ |
88
|
|
|
return $this->language; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Get all the methods applicable to Mobile detection |
93
|
|
|
* e.g isMobile() |
94
|
|
|
* @return \Mobile_Detect |
95
|
|
|
*/ |
96
|
|
|
public function mobile() : \Mobile_Detect |
97
|
|
|
{ |
98
|
|
|
return $this->mobile; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
} |
102
|
|
|
|