1 | <?php |
||
23 | class Mimmi20BrowserDetector extends AbstractProvider |
||
24 | { |
||
25 | /** |
||
26 | * Name of the provider |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $name = 'Mimmi20BrowserDetector'; |
||
31 | |||
32 | /** |
||
33 | * Homepage of the provider |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $homepage = 'https://github.com/mimmi20/BrowserDetector'; |
||
38 | |||
39 | /** |
||
40 | * Composer package name |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $packageName = 'mimmi20/browser-detector'; |
||
45 | |||
46 | protected $detectionCapabilities = [ |
||
47 | |||
48 | 'browser' => [ |
||
49 | 'name' => true, |
||
50 | 'version' => true, |
||
51 | ], |
||
52 | |||
53 | 'renderingEngine' => [ |
||
54 | 'name' => true, |
||
55 | 'version' => false, |
||
56 | ], |
||
57 | |||
58 | 'operatingSystem' => [ |
||
59 | 'name' => true, |
||
60 | 'version' => true, |
||
61 | ], |
||
62 | |||
63 | 'device' => [ |
||
64 | 'model' => true, |
||
65 | 'brand' => true, |
||
66 | 'type' => true, |
||
67 | 'isMobile' => false, |
||
68 | 'isTouch' => true, |
||
69 | ], |
||
70 | |||
71 | 'bot' => [ |
||
72 | 'isBot' => true, |
||
73 | 'name' => true, |
||
74 | 'type' => false, |
||
75 | ], |
||
76 | ]; |
||
77 | |||
78 | protected $defaultValues = [ |
||
79 | |||
80 | 'general' => [ |
||
81 | '/^unknown$/i', |
||
82 | ], |
||
83 | ]; |
||
84 | |||
85 | /** |
||
86 | * |
||
87 | * @var Detector |
||
88 | */ |
||
89 | private $parser; |
||
90 | |||
91 | /** |
||
92 | * |
||
93 | * @param Detector $parser |
||
94 | * @throws PackageNotLoadedException |
||
95 | */ |
||
96 | 15 | public function __construct(Detector $parser = null) |
|
104 | |||
105 | /** |
||
106 | * |
||
107 | * @return Detector |
||
108 | */ |
||
109 | 8 | public function getParser() |
|
122 | |||
123 | /** |
||
124 | * |
||
125 | * @param Result $result |
||
126 | * |
||
127 | * @return bool |
||
128 | */ |
||
129 | 7 | private function hasResult(Result $result) |
|
139 | |||
140 | /** |
||
141 | * |
||
142 | * @param Model\Bot $bot |
||
143 | * @param BrowserInterface $browserRaw |
||
144 | */ |
||
145 | 2 | private function hydrateBot(Model\Bot $bot, BrowserInterface $browserRaw) |
|
150 | |||
151 | /** |
||
152 | * |
||
153 | * @param Model\Browser $browser |
||
154 | * @param BrowserInterface $browserRaw |
||
155 | */ |
||
156 | 4 | private function hydrateBrowser(Model\Browser $browser, BrowserInterface $browserRaw) |
|
162 | |||
163 | /** |
||
164 | * |
||
165 | * @param Model\RenderingEngine $engine |
||
166 | * @param EngineInterface $engineRaw |
||
167 | */ |
||
168 | 4 | private function hydrateRenderingEngine(Model\RenderingEngine $engine, EngineInterface $engineRaw) |
|
173 | |||
174 | /** |
||
175 | * |
||
176 | * @param Model\OperatingSystem $os |
||
177 | * @param OsInterface $osRaw |
||
178 | */ |
||
179 | 4 | private function hydrateOperatingSystem(Model\OperatingSystem $os, OsInterface $osRaw) |
|
184 | |||
185 | /** |
||
186 | * |
||
187 | * @param Model\UserAgent $device |
||
188 | * @param DeviceInterface $deviceRaw |
||
189 | */ |
||
190 | 4 | private function hydrateDevice(Model\Device $device, DeviceInterface $deviceRaw) |
|
200 | |||
201 | 7 | public function parse($userAgent, array $headers = []) |
|
241 | } |
||
242 |