Completed
Push — master ( 6a4efb...35b143 )
by Dennis
01:26
created

Icon   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A maybe() 0 7 2
path() 0 1 ?
get() 0 1 ?
1
<?php
2
3
namespace lloc\Msls\Component;
4
5
/**
6
 * Class Icon
7
 * @package lloc\Msls\Component
8
 */
9
abstract class Icon {
10
11
	/**
12
	 * @var array
13
	 */
14
	protected $map;
15
16
	/**
17
	 * Icon constructor
18
	 */
19
	public function __construct() {
20
		$this->map = include $this->path();
21
	}
22
23
	/**
24
	 * @param string $language
25
	 * @param string $prefix
26
	 * @param string $postfix
27
	 *
28
	 * @return string
29
	 */
30
	protected function maybe( string $language, string $prefix = '', string $postfix = '' ): string {
31
		if ( 5 == strlen( $language ) ) {
32
			$language = strtolower( substr( $language, - 2 ) );
33
		}
34
35
		return $prefix . $language . $postfix;
36
	}
37
38
	/**
39
	 * @return string
40
	 */
41
	abstract protected function path(): string;
42
43
	/**
44
	 * @param string $language
45
	 *
46
	 * @return string
47
	 */
48
	abstract public function get( string $language ): string;
49
50
}