1 | <?php |
||
32 | 1 | final class Helpers extends Nette\Object |
|
33 | { |
||
34 | /** |
||
35 | * @var MobileDetect\MobileDetect |
||
36 | */ |
||
37 | private $mobileDetect; |
||
38 | |||
39 | /** |
||
40 | * @var MobileDetect\Helpers\DeviceView |
||
41 | */ |
||
42 | private $deviceView; |
||
43 | |||
44 | /** |
||
45 | * @param MobileDetect\MobileDetect $mobileDetect |
||
46 | * @param MobileDetect\Helpers\DeviceView $deviceView |
||
47 | */ |
||
48 | public function __construct( |
||
49 | MobileDetect\MobileDetect $mobileDetect, |
||
50 | MobileDetect\Helpers\DeviceView $deviceView |
||
51 | ) { |
||
52 | 1 | $this->mobileDetect = $mobileDetect; |
|
53 | 1 | $this->deviceView = $deviceView; |
|
54 | 1 | } |
|
55 | |||
56 | /** |
||
57 | * @return MobileDetect\MobileDetect |
||
58 | */ |
||
59 | public function getMobileDetectService() : MobileDetect\MobileDetect |
||
63 | |||
64 | /** |
||
65 | * @return MobileDetect\Helpers\DeviceView |
||
66 | */ |
||
67 | public function getDeviceViewService() : MobileDetect\Helpers\DeviceView |
||
71 | |||
72 | /** |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function isMobile() : bool |
||
79 | |||
80 | /** |
||
81 | * @return bool |
||
82 | */ |
||
83 | public function isPhone() : bool |
||
87 | |||
88 | /** |
||
89 | * @return bool |
||
90 | */ |
||
91 | public function isTablet() : bool |
||
92 | { |
||
93 | 1 | return $this->mobileDetect->isTablet(); |
|
94 | } |
||
95 | |||
96 | /** |
||
97 | * @param string $device |
||
98 | * |
||
99 | * @return bool |
||
100 | */ |
||
101 | public function isDevice(string $device) : bool |
||
102 | { |
||
103 | 1 | return $this->mobileDetect->is($device); |
|
104 | } |
||
105 | |||
106 | /** |
||
107 | * @param string $os |
||
108 | * |
||
109 | * @return bool |
||
110 | */ |
||
111 | public function isOs(string $os) : bool |
||
112 | { |
||
113 | 1 | return $this->mobileDetect->is($os); |
|
114 | } |
||
115 | |||
116 | /** |
||
117 | * @return bool |
||
118 | */ |
||
119 | public function isFullView() : bool |
||
123 | |||
124 | /** |
||
125 | * @return bool |
||
126 | */ |
||
127 | public function isMobileView() : bool |
||
131 | |||
132 | /** |
||
133 | * @return bool |
||
134 | */ |
||
135 | public function isPhoneView() : bool |
||
139 | |||
140 | /** |
||
141 | * @return bool |
||
142 | */ |
||
143 | public function isTabletView() : bool |
||
147 | |||
148 | /** |
||
149 | * @return bool |
||
150 | */ |
||
151 | public function isNotMobileView() : bool |
||
155 | } |
||
156 |