Completed
Push — master ( e02a77...1e7f08 )
by Adam
02:45
created

Helpers::getMobileDetectService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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
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 MobileDetect\MobileDetect
58
	 */
59
	public function getMobileDetectService() : MobileDetect\MobileDetect
60
	{
61
		return $this->mobileDetect;
62
	}
63
64
	/**
65
	 * @return MobileDetect\Helpers\DeviceView
66
	 */
67
	public function getDeviceViewService() : MobileDetect\Helpers\DeviceView
68
	{
69
		return $this->deviceView;
70
	}
71
72
	/**
73
	 * @return bool
74
	 */
75
	public function isMobile() : bool
76
	{
77
		return $this->mobileDetect->isMobile();
78
	}
79
80
	/**
81
	 * @return bool
82
	 */
83
	public function isTablet() : bool
84
	{
85
		return $this->mobileDetect->isTablet();
86
	}
87
}
88