architectures::get()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 108
Code Lines 85

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 108
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 85
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 108
ccs 108
cts 108
cp 1
crap 1
rs 8.3272

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
declare(strict_types = 1);
3
namespace hexydec\agentzero;
4
5
class architectures {
6
7
	/**
8
	 * Generates a configuration array for matching architectures
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 1
	public static function get() : array {
13 1
		return [
14 1
			'IA64' => new props('any', [
15 1
				'processor' => 'Intel',
16 1
				'architecture' => 'Itanium',
17 1
				'bits' => 64
18 1
			]),
19 1
			'x86_64' => new props('any', [
20 1
				'category' => 'desktop',
21 1
				'architecture' => 'x86',
22 1
				'bits' => 64
23 1
			]),
24 1
			'WOW64' => new props('any', [
25 1
				'category' => 'desktop',
26 1
				'architecture' => 'x86',
27 1
				'bits' => 64
28 1
			]),
29 1
			'amd64' => new props('any', [
30 1
				'category' => 'desktop',
31 1
				'architecture' => 'x86',
32 1
				'bits' => 64,
33 1
				'processor' => 'AMD'
34 1
			]),
35 1
			'armv7l' => new props('any', [
36 1
				'architecture' => 'Arm',
37 1
				'bits' => 32
38 1
			]),
39 1
			'aarch64' => new props('any', [
40 1
				'architecture' => 'Arm',
41 1
				'bits' => 64
42 1
			]),
43 1
			'arm64' => new props('any', [
44 1
				'architecture' => 'Arm',
45 1
				'bits' => 64
46 1
			]),
47 1
			'arm_64' => new props('any', [
48 1
				'architecture' => 'Arm',
49 1
				'bits' => 64
50 1
			]),
51 1
			'arm' => new props('any', [
52 1
				'architecture' => 'Arm',
53 1
				'bits' => 32
54 1
			]),
55 1
			'Intel' => new props('start', [
56 1
				'category' => 'desktop',
57 1
				'processor' => 'Intel',
58 1
				'architecture' => 'x86'
59 1
			]),
60 1
			'PPC' => new props('any', [
61 1
				'category' => 'desktop',
62 1
				'processor' => 'PowerPC',
63 1
				'architecture' => 'PowerPC'
64 1
			]),
65 1
			'x64' => new props('exact', [
66 1
				'category' => 'desktop',
67 1
				'architecture' => 'x86',
68 1
				'bits' => 64
69 1
			]),
70 1
			'x86' => new props('end', [
71 1
				'category' => 'desktop',
72 1
				'architecture' => 'x86',
73 1
				'bits' => 32
74 1
			]),
75 1
			'i686' => new props('any', [
76 1
				'category' => 'desktop',
77 1
				'architecture' => 'x86',
78 1
				'bits' => 32
79 1
			]),
80 1
			'i386' => new props('any', [
81 1
				'category' => 'desktop',
82 1
				'architecture' => 'x86',
83 1
				'bits' => 32
84 1
			]),
85 1
			'Sun' => new props('exact', [
86 1
				'category' => 'desktop',
87 1
				'architecture' => 'Sun'
88 1
			]),
89 1
			'SpreadTrum' => new props('exact', [
90 1
				'type' => 'human',
91 1
				'category' => 'mobile',
92 1
				'processor' => 'Unisoc'
93 1
			]),
94 1
			'sparc64' => new props('any', [
95 1
				'processor' => 'Fujitsu',
96 1
				'architecture' => 'Spark V9',
97 1
				'bits' => 64
98 1
			]),
99 1
			'sun4u' => new props('any', [
100 1
				'processor' => 'UltraSPARK',
101 1
				'architecture' => 'Spark V9',
102 1
				'bits' => 64
103 1
			]),
104 1
			'i86pc' => new props('any', [
105 1
				'category' => 'desktop',
106 1
				'architecture' => 'x86',
107 1
				'bits' => 32
108 1
			]),
109 1
			'i86xpv' => new props('any', [
110 1
				'category' => 'desktop',
111 1
				'architecture' => 'x86',
112 1
				'virtualised' => true,
113 1
				'bits' => 32
114 1
			]),
115 1
			'Qualcomm' => new props('any', [
116 1
				'processor' => 'Qualcomm'
117 1
			]),
118 1
			'Mhz' => new props('end', fn (string $value) : array => [
119 1
				'cpuclock' => \intval(\mb_substr($value, 0, -3))
120 1
			])
121 1
		];
122
	}
123
}