engines   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 25
c 1
b 0
f 0
dl 0
loc 37
ccs 30
cts 30
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 30 1
1
<?php
2
declare(strict_types = 1);
3
namespace hexydec\agentzero;
4
5
class engines {
6
7
	/**
8
	 * Generates a configuration array for matching engines
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 41
	public static function get() : array {
13 1
		return [
14 1
			'Goanna/' => new props('start', fn (string $value) : array => [
15 3
				'type' => 'human',
16 3
				'engine' => 'Goanna',
17 3
				'engineversion' => \mb_substr($value, 7)
18 3
			]),
19 1
			'Gecko/' => new props('start', fn (string $value) : array => [
20 20
				'type' => 'human',
21 20
				'engine' => 'Gecko',
22 20
				'engineversion' => \mb_substr($value, 6)
23 20
			]),
24 1
			'Gecko' => new props('exact', [
25 1
				'type' => 'human',
26 1
				'engine' => 'Gecko'
27 1
			]),
28 1
			'Presto/' => new props('start', fn (string $value) : array => [
29 5
				'type' => 'human',
30 5
				'engine' => 'Presto',
31 5
				'engineversion' => \mb_substr($value, 7)
32 5
			]),
33 1
			'Trident/' => new props('start', fn (string $value) : array => [
34 12
				'type' => 'human',
35 12
				'engine' => 'Trident',
36 12
				'engineversion' => \mb_substr($value, 8)
37 12
			]),
38 1
			'AppleWebKit/' => new props('start', fn (string $value) : array => [
39 41
				'type' => 'human',
40 41
				'engine' => 'WebKit',
41 41
				'engineversion' => \mb_substr($value, 12)
42 41
			]),
43 1
		];
44
	}
45
}