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

ConstraintViolationViewer::getIcon()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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