1 | <?php |
||
17 | class FiftyOneDegreesCom extends AbstractHttpProvider |
||
18 | { |
||
19 | /** |
||
20 | * Name of the provider |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $name = 'FiftyOneDegreesCom'; |
||
25 | |||
26 | /** |
||
27 | * Homepage of the provider |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $homepage = 'https://51degrees.com'; |
||
32 | |||
33 | protected $detectionCapabilities = [ |
||
34 | |||
35 | 'browser' => [ |
||
36 | 'name' => true, |
||
37 | 'version' => true, |
||
38 | ], |
||
39 | |||
40 | 'renderingEngine' => [ |
||
41 | 'name' => true, |
||
42 | 'version' => true, |
||
43 | ], |
||
44 | |||
45 | 'operatingSystem' => [ |
||
46 | 'name' => true, |
||
47 | 'version' => true, |
||
48 | ], |
||
49 | |||
50 | 'device' => [ |
||
51 | 'model' => false, |
||
52 | 'brand' => false, |
||
53 | 'type' => true, |
||
54 | 'isMobile' => false, |
||
55 | 'isTouch' => false, |
||
56 | ], |
||
57 | |||
58 | 'bot' => [ |
||
59 | 'isBot' => false, |
||
60 | 'name' => false, |
||
61 | 'type' => false, |
||
62 | ], |
||
63 | ]; |
||
64 | |||
65 | protected $defaultValues = [ |
||
66 | 'general' => [ |
||
67 | '/^Unknown$/i', |
||
68 | ], |
||
69 | ]; |
||
70 | |||
71 | private static $uri = 'https://cloud.51degrees.com/api/v1'; |
||
72 | |||
73 | private $apiKey; |
||
74 | |||
75 | public function __construct(Client $client, $apiKey) |
||
81 | |||
82 | /** |
||
83 | * |
||
84 | * @param string $userAgent |
||
85 | * @param array $headers |
||
86 | * @return stdClass |
||
87 | * @throws Exception\RequestException |
||
88 | */ |
||
89 | protected function getResult($userAgent, array $headers) |
||
175 | |||
176 | /** |
||
177 | * |
||
178 | * @param Model\Browser $browser |
||
179 | * @param stdClass $resultRaw |
||
180 | */ |
||
181 | private function hydrateBrowser(Model\Browser $browser, stdClass $resultRaw) |
||
191 | |||
192 | /** |
||
193 | * |
||
194 | * @param Model\RenderingEngine $engine |
||
195 | * @param stdClass $resultRaw |
||
196 | */ |
||
197 | private function hydrateRenderingEngine(Model\RenderingEngine $engine, stdClass $resultRaw) |
||
207 | |||
208 | /** |
||
209 | * |
||
210 | * @param Model\OperatingSystem $os |
||
211 | * @param stdClass $resultRaw |
||
212 | */ |
||
213 | private function hydrateOperatingSystem(Model\OperatingSystem $os, stdClass $resultRaw) |
||
223 | |||
224 | /** |
||
225 | * |
||
226 | * @param Model\Device $device |
||
227 | * @param stdClass $resultRaw |
||
228 | */ |
||
229 | private function hydrateDevice(Model\Device $device, stdClass $resultRaw) |
||
235 | |||
236 | public function parse($userAgent, array $headers = []) |
||
256 | } |
||
257 |