Completed
Push — master ( 3ee6aa...f7422c )
by Jean-Christophe
02:00
created

CRUDMessage::setIcon()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Ubiquity\controllers\crud;
4
5
class CRUDMessage {
6
	private $message;
7
	private $type;
8
	private $icon;
9
	private $title;
10
	private $timeout;
11
	private $_message;
12
	
13
	public function __construct($message,$title="",$type="",$icon="",$timeout=null){
14
		$this->message=$message;
15
		$this->title=$title;
16
		$this->type=$type;
17
		$this->icon=$icon;
18
		$this->timeout=$timeout;
19
		$this->_message=$message;
20
	}
21
	
22
	/**
23
	 * @return string
24
	 */
25
	public function getMessage() {
26
		return $this->_message;
27
	}
28
29
	/**
30
	 * @return string
31
	 */
32
	public function getType() {
33
		return $this->type;
34
	}
35
36
	/**
37
	 * @return mixed
38
	 */
39
	public function getIcon() {
40
		return $this->icon;
41
	}
42
43
	/**
44
	 * @return string
45
	 */
46
	public function getTitle() {
47
		return $this->title;
48
	}
49
50
	/**
51
	 * @param string $message
52
	 */
53
	public function setMessage($message) {
54
		$this->_message = $message;
55
		$this->message=$message;
56
	}
57
58
	/**
59
	 * @param string $type
60
	 * @return $this
61
	 */
62
	public function setType($type) {
63
		$this->type = $type;
64
		return $this;
65
	}
66
67
	/**
68
	 * @param string $icon
69
	 * @return $this
70
	 */
71
	public function setIcon($icon) {
72
		$this->icon = $icon;
73
		return $this;
74
	}
75
76
	/**
77
	 * @param string $title
78
	 * @return $this
79
	 */
80
	public function setTitle($title) {
81
		$this->title = $title;
82
		return $this;
83
	}
84
	
85
	/**
86
	 * @return integer
87
	 */
88
	public function getTimeout() {
89
		return $this->timeout;
90
	}
91
92
	/**
93
	 * @param integer $timeout
94
	 * @return $this
95
	 */
96
	public function setTimeout($timeout) {
97
		$this->timeout = $timeout;
98
		return $this;
99
	}
100
	/**
101
	 * 
102
	 * @param string $value
103
	 * @return $this
104
	 */
105
	public function parse($value){
106
		$this->_message=str_replace("{value}", $value, $this->message);
107
		return $this;
108
	}
109
	
110 View Code Duplication
	public function parseContent($keyValues){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
111
		$msg=$this->_message;
112
		foreach ($keyValues as $key=>$value){
113
			$msg=str_replace("{".$key."}", $value, $msg);
114
		}
115
		$this->_message=$msg;
116
		return $this;
117
	}
118
119
}
120
121