Completed
Push — master ( b19c96...9aea22 )
by Jean-Christophe
01:59
created

FlashMessage   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 15
lcom 1
cbo 0
dl 0
loc 85
rs 10
c 3
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A setValues() 0 9 4
A getContent() 0 3 1
A getType() 0 3 1
A getIcon() 0 3 1
A setContent() 0 3 1
A setType() 0 3 1
A setIcon() 0 3 1
A getTitle() 0 3 1
A setTitle() 0 3 1
A parseContent() 0 8 2
1
<?php
2
3
namespace Ubiquity\utils\flash;
4
5
class FlashMessage {
6
	protected $title;
7
	protected $content;
8
	protected $type;
9
	protected $icon;
10
11
	public function __construct($content,$title=NULL,$type="info",$icon=null){
12
		$this->setValues($content,$title,$type,$icon);
13
	}
14
	
15
	public function setValues($content,$title=NULL,$type=NULL,$icon=null){
16
		if(isset($type))
17
			$this->type=$type;
18
		$this->content=$content;
19
		if(isset($icon))
20
			$this->icon=$icon;
21
		if(isset($title))
22
			$this->title=$title;
23
	}
24
	/**
25
	 * @return mixed
26
	 */
27
	public function getContent() {
28
		return $this->content;
29
	}
30
31
	/**
32
	 * @return mixed
33
	 */
34
	public function getType() {
35
		return $this->type;
36
	}
37
38
	/**
39
	 * @return mixed
40
	 */
41
	public function getIcon() {
42
		return $this->icon;
43
	}
44
45
	/**
46
	 * @param mixed $content
47
	 */
48
	public function setContent($content) {
49
		$this->content = $content;
50
	}
51
52
	/**
53
	 * @param mixed $type
54
	 */
55
	public function setType($type) {
56
		$this->type = $type;
57
	}
58
59
	/**
60
	 * @param mixed $icon
61
	 */
62
	public function setIcon($icon) {
63
		$this->icon = $icon;
64
	}
65
	/**
66
	 * @return mixed
67
	 */
68
	public function getTitle() {
69
		return $this->title;
70
	}
71
72
	/**
73
	 * @param mixed $title
74
	 */
75
	public function setTitle($title) {
76
		$this->title = $title;
77
	}
78
	
79
	public function parseContent($keyValues){
80
		$msg=$this->content;
81
		foreach ($keyValues as $key=>$value){
82
			$msg=str_replace("{".$key."}", $value, $msg);
83
		}
84
		$this->content=$msg;
85
		return $this;
86
	}
87
88
89
}
90
91