Passed
Push — main ( 7b37bf...2735bf )
by N.
03:10
created

Vinstmarkering   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 13
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A vinstfärg() 0 7 4
1
<?php
2
3
/**
4
 * Klass Vinstmarkering.
5
 * @author Niklas Dougherty
6
 */
7
8
declare(strict_types=1);
9
10
namespace Tips\Moduler\System;
11
12
/**
13
 * Klass Vinstmarkering.
14
 */
15
final class Vinstmarkering {
16
	/**
17
	 * Visa vinst eller förlust.
18
	 * @param string[] $matris
19
	 * @param string[] $arr
20
	 */
21
	public function vinstfärg(array &$matris, array $arr, string $tecken): void {
22
		foreach (array_keys($matris) as $index) {
23
			$förlust = $index === 1 ? ' förlust' : ' storförlust';
24
25
			$matris[$index] = match (empty($arr[$index])) {
26
				true => '',
27
				default => ($arr[$index] == $tecken) ? ' vinst' : $förlust
28
			};
29
		}
30
	}
31
}
32