Passed
Push — main ( 910f4b...bcdb57 )
by Will
02:58
created

frameworks::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 9
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 12
ccs 12
cts 12
cp 1
crap 1
rs 9.9666
1
<?php
2
declare(strict_types = 1);
3
namespace hexydec\agentzero;
4
5
class frameworks {
6
7
	/**
8
	 * Generates a configuration array for matching app frameworks
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 5
	public static function get() : array {
13 1
		return [
14 1
			'Electron/' => new props('start', fn (string $value) : array => [
15 5
				'framework' => 'Electron',
16 5
				'frameworkversion' => \explode('/', $value, 3)[1]
17 5
			]),
18 1
			'MAUI' => new props('start', [
19 1
				'framework' => 'MAUI'
20 1
			]),
21 1
			'Cordova' => new props('start', fn (string $value) : array => [
22 2
				'framework' => 'Cordova',
23 2
				'frameworkversion' => \explode('/', $value, 3)[1]
24 2
			])
25 1
		];
26
	}
27
}