special   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 28
c 1
b 0
f 0
dl 0
loc 45
ccs 32
cts 32
cp 1
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 38 4
1
<?php
2
declare(strict_types = 1);
3
namespace hexydec\agentzero;
4
5
class special {
6
7
	/**
8
	 * Generates a configuration array for matching other
9
	 * 
10
	 * @return array<string,props> An array with keys representing the string to match, and values a props object defining how to generate the match and which properties to set
11
	 */
12 2
	public static function get() : array {
13 1
		return [
14
15
			// has a URL in the UA, but human
16 1
			'TencentTraveler' => new props('start', fn (string $value) : array => [
17 2
				'type' => 'human',
18 2
				'category' => 'desktop',
19 2
				'browser' => 'Tencent Traveler',
20 2
				'browserversion' => \mb_substr($value, 16) ?: null
21 2
			]),
22 1
			'QQDownload ' => new props('start', fn (string $value) : array => [
23 2
				'app' => 'QQDownload',
24 2
				'appname' => 'QQDownload',
25 2
				'appversion' => \mb_substr($value, 11)
26 2
			]),
27 1
			'EmbeddedWB ' => new props('start', fn (string $value) : array => [
28 2
				'type' => 'human',
29 2
				'category' => 'desktop',
30 2
				'app' => 'Embedded Web Browser',
31 2
				'appname' => 'EmbeddedWB',
32 2
				'appversion' => \explode(' ', $value, 3)[1]
33 2
			]),
34
35
			// avant browser
36 1
			'Avant Browser' => new props('start', fn (string $value) : array => [
37 2
				'type' => 'human',
38 2
				'category' => 'desktop',
39 2
				'browser' => 'Avant Browser',
40 2
				'browserversion' => \mb_substr($value, 14) ?: null
41 2
			]),
42
43
			// grub
44 1
			'grub-client-' => new props('start', fn (string $value) : array => [
45 2
				'type' => 'robot',
46 2
				'category' => 'scraper',
47 2
				'app' => 'Grub Client',
48 2
				'appname' => 'grub-client',
49 2
				'appversion' => \mb_substr($value, 12) ?: null
50 2
			])
51 1
		];
52
	}
53
}