1 | <?php |
||
15 | class HandsetDetection extends AbstractProvider |
||
16 | { |
||
17 | /** |
||
18 | * Name of the provider |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $name = 'HandsetDetection'; |
||
23 | |||
24 | /** |
||
25 | * Homepage of the provider |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $homepage = 'https://github.com/HandsetDetection/php-apikit'; |
||
30 | |||
31 | /** |
||
32 | * Composer package name |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $packageName = 'handsetdetection/php-apikit'; |
||
37 | |||
38 | protected $detectionCapabilities = [ |
||
39 | |||
40 | 'browser' => [ |
||
41 | 'name' => true, |
||
42 | 'version' => true, |
||
43 | ], |
||
44 | |||
45 | 'renderingEngine' => [ |
||
46 | 'name' => false, |
||
47 | 'version' => false, |
||
48 | ], |
||
49 | |||
50 | 'operatingSystem' => [ |
||
51 | 'name' => true, |
||
52 | 'version' => true, |
||
53 | ], |
||
54 | |||
55 | 'device' => [ |
||
56 | 'model' => true, |
||
57 | 'brand' => true, |
||
58 | 'type' => false, |
||
59 | 'isMobile' => false, |
||
60 | 'isTouch' => false, |
||
61 | ], |
||
62 | |||
63 | 'bot' => [ |
||
64 | 'isBot' => false, |
||
65 | 'name' => false, |
||
66 | 'type' => false, |
||
67 | ], |
||
68 | ]; |
||
69 | |||
70 | protected $defaultValues = [ |
||
71 | |||
72 | 'general' => [ |
||
73 | '/^generic$/i', |
||
74 | ], |
||
75 | |||
76 | 'device' => [ |
||
77 | 'model' => [ |
||
78 | '/analyzer/i', |
||
79 | '/bot/i', |
||
80 | '/crawler/i', |
||
81 | '/library/i', |
||
82 | '/spider/i', |
||
83 | ], |
||
84 | ], |
||
85 | ]; |
||
86 | |||
87 | /** |
||
88 | * |
||
89 | * @var Parser\HD4 |
||
90 | */ |
||
91 | private $parser; |
||
92 | |||
93 | /** |
||
94 | * |
||
95 | * @param Parser\HD4 $parser |
||
96 | */ |
||
97 | 12 | public function __construct(Parser\HD4 $parser) |
|
101 | |||
102 | /** |
||
103 | * |
||
104 | * @return Parser\HD4 |
||
105 | */ |
||
106 | 5 | public function getParser() |
|
110 | |||
111 | /** |
||
112 | * |
||
113 | * @param array $resultRaw |
||
114 | * |
||
115 | * @return bool |
||
116 | */ |
||
117 | 4 | private function hasResult(array $resultRaw) |
|
133 | |||
134 | /** |
||
135 | * |
||
136 | * @param Model\Browser $browser |
||
137 | * @param array $resultRaw |
||
138 | */ |
||
139 | 3 | private function hydrateBrowser(Model\Browser $browser, array $resultRaw) |
|
148 | |||
149 | /** |
||
150 | * |
||
151 | * @param Model\OperatingSystem $os |
||
152 | * @param array $resultRaw |
||
153 | */ |
||
154 | 3 | private function hydrateOperatingSystem(Model\OperatingSystem $os, array $resultRaw) |
|
163 | |||
164 | /** |
||
165 | * |
||
166 | * @param Model\UserAgent $device |
||
167 | * @param array $resultRaw |
||
168 | */ |
||
169 | 3 | private function hydrateDevice(Model\Device $device, array $resultRaw) |
|
176 | |||
177 | 5 | public function parse($userAgent, array $headers = []) |
|
218 | } |
||
219 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.