Completed
Push — master ( 59da10...169aaf )
by Sergio
02:28
created

DeviceDetector::getModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace coderius\hitCounter\components\deviceDetect;
4
5
use  coderius\hitCounter\components\deviceDetect\IDeviceDetect;
6
use  yii;
7
use  yii\base\BaseObject;
8
use  yii\web\Request;
9
use  DeviceDetector\DeviceDetector as DD;
10
use  DeviceDetector\Parser\Device\DeviceParserAbstract;
11
use yii\base\Component;
12
13
class DeviceDetector extends  Component implements IDeviceDetect{
14
15
    private $detector;
16
17
    public function __construct(Request $request, $config = [])
18
    {
19
        $userAgent = $request->getUserAgent();
20
        $this->detector = new DD($userAgent);
21
        $this->detector->parse();
22
        parent::__construct($config);
23
        
24
    }
25
26
    public function getOs($attr = '')
27
    {
28
        return $this->detector->getOs();
29
    }
30
31
32
    public function getClient($attr = '')
33
    {
34
        return $this->detector->getClient($attr = '');
35
    }
36
37
    public function getDevice()
38
    {
39
        return $this->detector->getDevice();
40
    }
41
42
    public function getDeviceName()
43
    {
44
        return $this->detector->getDeviceName();
45
    }
46
47
    public function getBrand()
48
    {
49
        return $this->detector->getBrand();
50
    }
51
52
    public function getBrandName()
53
    {
54
        return $this->detector->getBrandName();
55
    }
56
    
57
    public function getModel()
58
    {
59
        return $this->detector->getModel();
60
    }
61
62
    public function getUserAgent()
63
    {
64
        return $this->detector->getUserAgent();
65
    }
66
67
    public function getBot()
68
    {
69
        return $this->detector->getBot();
70
    }
71
72
    
73
}