1 | <?php |
||
9 | class Zsxsoft extends AbstractProvider |
||
10 | { |
||
11 | /** |
||
12 | * Name of the provider |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $name = 'Zsxsoft'; |
||
17 | |||
18 | /** |
||
19 | * Homepage of the provider |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $homepage = 'https://github.com/zsxsoft/php-useragent'; |
||
24 | |||
25 | /** |
||
26 | * Composer package name |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $packageName = 'zsxsoft/php-useragent'; |
||
31 | |||
32 | protected $detectionCapabilities = [ |
||
33 | |||
34 | 'browser' => [ |
||
35 | 'name' => true, |
||
36 | 'version' => true, |
||
37 | ], |
||
38 | |||
39 | 'renderingEngine' => [ |
||
40 | 'name' => false, |
||
41 | 'version' => false, |
||
42 | ], |
||
43 | |||
44 | 'operatingSystem' => [ |
||
45 | 'name' => true, |
||
46 | 'version' => true, |
||
47 | ], |
||
48 | |||
49 | 'device' => [ |
||
50 | 'model' => true, |
||
51 | 'brand' => true, |
||
52 | 'type' => false, |
||
53 | 'isMobile' => false, |
||
54 | 'isTouch' => false, |
||
55 | ], |
||
56 | |||
57 | 'bot' => [ |
||
58 | 'isBot' => false, |
||
59 | 'name' => false, |
||
60 | 'type' => false, |
||
61 | ], |
||
62 | ]; |
||
63 | |||
64 | protected $defaultValues = [ |
||
65 | |||
66 | 'general' => [ |
||
67 | '/^Unknown$/i', |
||
68 | ], |
||
69 | ]; |
||
70 | |||
71 | private $parser; |
||
72 | |||
73 | /** |
||
74 | * @param UserAgent $parser |
||
75 | * @throws PackageNotLoadedException |
||
76 | */ |
||
77 | 13 | public function __construct(UserAgent $parser = null) |
|
85 | |||
86 | /** |
||
87 | * |
||
88 | * @return UserAgent |
||
89 | */ |
||
90 | 6 | public function getParser() |
|
100 | |||
101 | /** |
||
102 | * |
||
103 | * @param array $browser |
||
104 | * @param array $os |
||
105 | * @param array $device |
||
106 | * |
||
107 | * @return bool |
||
108 | */ |
||
109 | 5 | private function hasResult(array $browser, array $os, array $device) |
|
129 | |||
130 | /** |
||
131 | * |
||
132 | * @param Model\Browser $browser |
||
133 | * @param array $browserRaw |
||
134 | */ |
||
135 | 4 | private function hydrateBrowser(Model\Browser $browser, array $browserRaw) |
|
145 | |||
146 | /** |
||
147 | * |
||
148 | * @param Model\OperatingSystem $os |
||
149 | * @param array $osRaw |
||
150 | */ |
||
151 | 4 | private function hydrateOperatingSystem(Model\OperatingSystem $os, array $osRaw) |
|
161 | |||
162 | /** |
||
163 | * |
||
164 | * @param Model\Device $device |
||
165 | * @param array $deviceRaw |
||
166 | */ |
||
167 | 4 | private function hydrateDevice(Model\Device $device, array $deviceRaw) |
|
177 | |||
178 | 5 | public function parse($userAgent, array $headers = []) |
|
215 | } |
||
216 |