Completed
Push — gh-27-android-devices ( 34c0bd )
by Serhii
02:00
created

DeviceDetector   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A afterDetection() 0 10 3
1
<?php
2
/**
3
 * @author Serhii Nekhaienko <[email protected]>
4
 * @license GPL
5
 * @copyright Serhii Nekhaienko &copy 2018
6
 * @version 4.0.0
7
 * @project endorphin-studio/browser-detector
8
 */
9
10
namespace EndorphinStudio\Detector\Detection;
11
12
/**
13
 * Detector for device
14
 * Class DeviceDetector
15
 * @package EndorphinStudio\Detector\Detection
16
 */
17
class DeviceDetector extends BrowserDetector
18
{
19
    /**
20
     * @var string Key in config
21
     */
22
    protected $configKey = 'device';
23
24
    protected function afterDetection()
25
    {
26
        if(\array_key_exists('hasModel', $this->additionalInfo['originalInfo']) && $this->additionalInfo['originalInfo']['hasModel'] === true) {
27
            // detect model
28
            $detector = new ModelDetector();
29
            $detector->init($this->detector);
30
            $detector->detect($this->additionalInfo);
31
        }
32
        parent::afterDetection();
33
    }
34
}