@@ 8-30 (lines=23) @@ | ||
5 | ||
6 | use EndorphinStudio\Detector\Tools; |
|
7 | ||
8 | class BrowserDetector extends AbstractDetection |
|
9 | { |
|
10 | public function detect(string $ua) |
|
11 | { |
|
12 | $this->config = $this->detector->getPatternList($this->detector->getDataProvider()->getConfig(), 'browser'); |
|
13 | $this->resultObject = $this->detector->getResultObject()->getBrowser(); |
|
14 | $this->initResultObject(); |
|
15 | $this->setupResultObject(); |
|
16 | } |
|
17 | ||
18 | ||
19 | protected function setupResultObject() |
|
20 | { |
|
21 | $browserData = $this->detectByType(); |
|
22 | foreach ($browserData as $key => $value) { |
|
23 | if ($key === 'originalInfo') { |
|
24 | $this->setAttributes($value); |
|
25 | continue; |
|
26 | } |
|
27 | Tools::runSetter($this->resultObject, $key, $value); |
|
28 | } |
|
29 | } |
|
30 | } |
@@ 8-30 (lines=23) @@ | ||
5 | ||
6 | use EndorphinStudio\Detector\Tools; |
|
7 | ||
8 | class DeviceDetector extends AbstractDetection |
|
9 | { |
|
10 | public function detect(string $ua) |
|
11 | { |
|
12 | $this->config = $this->detector->getPatternList($this->detector->getDataProvider()->getConfig(), 'device'); |
|
13 | $this->resultObject = $this->detector->getResultObject()->getDevice(); |
|
14 | $this->initResultObject(); |
|
15 | $this->setupResultObject(); |
|
16 | } |
|
17 | ||
18 | ||
19 | protected function setupResultObject() |
|
20 | { |
|
21 | $browserData = $this->detectByType(); |
|
22 | foreach ($browserData as $key => $value) { |
|
23 | if ($key === 'originalInfo') { |
|
24 | $this->setAttributes($value); |
|
25 | continue; |
|
26 | } |
|
27 | Tools::runSetter($this->resultObject, $key, $value); |
|
28 | } |
|
29 | } |
|
30 | } |