BrowserDetector   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 21
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A setupResultObject() 0 11 3
1
<?php
2
/**
3
 * @author Serhii Nekhaienko <[email protected]>
4
 * @license GPL
5
 * @copyright Serhii Nekhaienko &copy 2020
6
 * @version 2.0.0
7
 * @project endorphin-studio/browser-detector-detection
8
 */
9
10
namespace EndorphinStudio\Detector\Detection;
11
12
use EndorphinStudio\Detector\Tools;
13
14
/**
15
 * Detector of browser
16
 * Class BrowserDetector
17
 * @package EndorphinStudio\Detector\Detection
18
 */
19
class BrowserDetector extends AbstractDetection
20
{
21
    /**
22
     * @var string Key in config
23
     */
24
    protected $configKey = 'browser';
25
26
    /**
27
     * Setup result of object
28
     */
29
    protected function setupResultObject()
30
    {
31
        $browserData = $this->detectByType();
32
        foreach ($browserData as $key => $value) {
33
            if ($key === 'originalInfo') {
34
                $this->setAttributes($value);
35
                continue;
36
            }
37
            Tools::runSetter($this->resultObject, $key, $value);
38
        }
39
        $this->additionalInfo = $browserData;
40
    }
41
}