Passed
Push — master ( c6a028...bcb7cf )
by Jean-Christophe
06:36
created

ConstraintViolationViewer   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
eloc 11
dl 0
loc 20
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 2 1
A getIcon() 0 2 1
A getValue() 0 5 3
1
<?php
2
3
namespace Ubiquity\contents\validation\validators;
4
5
class ConstraintViolationViewer {
6
	const SEVERITY_ICONS=[
7
			'default'=>['icon'=>'thumbtack','type'=>''],
8
			'info'=>['icon'=>'info circle','type'=>'info'],
9
			'warning'=>['icon'=>'exclamation circle','type'=>'warning'],
10
			'error'=>['icon'=>'exclamation triangle','type'=>'error']
11
	];
12
	
13
	private static function getValue($severity){
14
		if(isset($severity) && isset(self::SEVERITY_ICONS[$severity])){
15
			return self::SEVERITY_ICONS[$severity];
16
		}
17
		return self::SEVERITY_ICONS['default'];
18
	}
19
	public static function getIcon($severity){
20
		return self::getValue($severity)['icon'];
21
	}
22
	
23
	public static function getType($severity){
24
		return self::getValue($severity)['type'];
25
	}
26
}
27
28