Completed
Push — master ( 69e9f4...3042e6 )
by Jean-Christophe
04:01
created

HtmlFlag   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 21
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setFlag() 0 3 1
A France() 0 3 1
A byNum() 0 3 1
1
<?php
2
3
namespace Ajax\semantic\html\elements;
4
5
use Ajax\common\html\HtmlSingleElement;
6
use Ajax\semantic\html\base\constants\Country;
7
8
/**
9
 * Semantic Flag component
10
 * @see http://semantic-ui.com/elements/flag.html
11
 * @author jc
12
 * @version 1.001
13
 */
14
class HtmlFlag extends HtmlSingleElement {
15
	protected $flag;
16
17
	public function __construct($identifier, $flag) {
18
		parent::__construct($identifier, "i");
19
		$this->_template='<i class="%flag% flag"></i>';
20
		$this->flag=$flag;
21
	}
22
23
	public function setFlag($flag) {
24
		$this->flag=$flag;
25
	}
26
27
	public static function France() {
28
		return new HtmlFlag("", Country::FRANCE);
29
	}
30
31
	public static function byNum($num) {
32
		return new HtmlFlag("", Country::getConstantValues()[$num]);
33
	}
34
}