@@ -4,8 +4,6 @@ |
||
4 | 4 | namespace EndorphinStudio\Detector\Detection; |
5 | 5 | |
6 | 6 | |
7 | -use EndorphinStudio\Detector\Data\AbstractData; |
|
8 | -use EndorphinStudio\Detector\Data\Os; |
|
9 | 7 | use EndorphinStudio\Detector\Tools; |
10 | 8 | |
11 | 9 | class OsDetector extends AbstractDetection |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $result = []; |
32 | 32 | foreach ($this->config as $family => $data) { |
33 | - if($family === 'default') { |
|
33 | + if ($family === 'default') { |
|
34 | 34 | continue; |
35 | 35 | } |
36 | 36 | $this->detectByDeviceType($family); |
@@ -54,18 +54,18 @@ discard block |
||
54 | 54 | $useDefault = false; |
55 | 55 | $pattern = '/%s/'; |
56 | 56 | $version = '%s'; |
57 | - if(array_key_exists('default', $patternData) && $patternData['default'] === true) { |
|
57 | + if (array_key_exists('default', $patternData) && $patternData['default'] === true) { |
|
58 | 58 | $useDefault = true; |
59 | 59 | $pattern = sprintf($pattern, $patternId); |
60 | 60 | $version = Tools::getVersionPattern(sprintf($version, $patternId)); |
61 | 61 | } |
62 | 62 | |
63 | - if(!$useDefault) { |
|
63 | + if (!$useDefault) { |
|
64 | 64 | $pattern = sprintf($pattern, $patternData['pattern']); |
65 | 65 | $version = Tools::getVersionPattern(sprintf($version, $patternData['version'])); |
66 | 66 | } |
67 | 67 | |
68 | - if(preg_match($pattern, $this->detector->getUserAgent())) { |
|
68 | + if (preg_match($pattern, $this->detector->getUserAgent())) { |
|
69 | 69 | echo 'BINGO'; |
70 | 70 | } |
71 | 71 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | - * @return mixed |
|
54 | + * @return string |
|
55 | 55 | */ |
56 | 56 | public function getUserAgent() |
57 | 57 | { |
@@ -109,6 +109,9 @@ discard block |
||
109 | 109 | |
110 | 110 | } |
111 | 111 | |
112 | + /** |
|
113 | + * @param string $type |
|
114 | + */ |
|
112 | 115 | public function getPatternList($list, $type) |
113 | 116 | { |
114 | 117 | return array_key_exists($type, $list) ? $list[$type] : []; |
@@ -82,7 +82,7 @@ |
||
82 | 82 | $check = ['device', 'os', 'browser', 'robots']; |
83 | 83 | foreach ($check as $detectionnType) { |
84 | 84 | $className = sprintf('\\EndorphinStudio\\Detector\\Detection\\%s', ucfirst(sprintf('%sDetector', $detectionnType))); |
85 | - if(class_exists($className)) { |
|
85 | + if (class_exists($className)) { |
|
86 | 86 | $this->detectors[$detectionnType] = new $className(); |
87 | 87 | $this->detectors[$detectionnType]->init($this); |
88 | 88 | } |