Completed
Push — master ( afe79f...952cdd )
by Adam
02:21
created

Helpers::isPhoneView()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Helpers.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        http://www.ipublikuj.eu
7
 * @author         Adam Kadlec http://www.ipublikuj.eu
8
 * @package        iPublikuj:MobileDetect!
9
 * @subpackage     Templating
10
 * @since          1.0.0
11
 *
12
 * @date           16.06.14
13
 */
14
15
declare(strict_types = 1);
16
17
namespace IPub\MobileDetect\Templating;
18
19
use Nette;
20
21
use IPub;
22
use IPub\MobileDetect;
23
24
/**
25
 * Mobile detect template helpers
26
 *
27
 * @package        iPublikuj:MobileDetect!
28
 * @subpackage     Templating
29
 *
30
 * @author         Adam Kadlec <[email protected]>
31
 */
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
		$this->mobileDetect = $mobileDetect;
53
		$this->deviceView = $deviceView;
54
	}
55
56
	/**
57
	 * @return bool
58
	 */
59
	public function isMobile() : bool
60
	{
61
		return $this->mobileDetect->isMobile();
62
	}
63
64
	/**
65
	 * @return bool
66
	 */
67
	public function isPhone() : bool
68
	{
69
		return $this->mobileDetect->isPhone();
70
	}
71
72
	/**
73
	 * @return bool
74
	 */
75
	public function isTablet() : bool
76
	{
77
		return $this->mobileDetect->isTablet();
78
	}
79
80
	/**
81
	 * @param string $device
82
	 *
83
	 * @return bool
84
	 */
85
	public function isDevice(string $device) : bool
86
	{
87 1
		return $this->mobileDetect->is($device);
88
	}
89
90
	/**
91
	 * @param string $os
92
	 *
93
	 * @return bool
94
	 */
95
	public function isOs(string $os) : bool
96
	{
97
		return $this->mobileDetect->is($os);
98
	}
99
100
	/**
101
	 * @return bool
102
	 */
103
	public function isFullView() : bool
104
	{
105
		return $this->deviceView->isFullView();
106
	}
107
108
	/**
109
	 * @return bool
110
	 */
111
	public function isMobileView() : bool
112
	{
113
		return $this->deviceView->isMobileView();
114
	}
115
116
	/**
117
	 * @return bool
118
	 */
119
	public function isPhoneView() : bool
120
	{
121
		return $this->deviceView->isPhoneView();
122
	}
123
124
	/**
125
	 * @return bool
126
	 */
127
	public function isTabletView() : bool
128
	{
129
		return $this->deviceView->isTabletView();
130
	}
131
132
	/**
133
	 * @return bool
134
	 */
135
	public function isNotMobileView() : bool
136
	{
137
		return $this->deviceView->isNotMobileView();
138
	}
139
}
140