DisplayedMessage   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 13
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 53
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A DisplayedMessage() 0 7 1
A getContent() 0 3 1
A setContent() 0 4 1
A getType() 0 3 1
A setType() 0 4 1
A getTimerInterval() 0 3 1
A setTimerInterval() 0 4 1
A getDismissable() 0 3 1
A setDismissable() 0 4 1
A compile() 0 11 4
1
<?php
2
/**
3
 * Repr�sente un message � afficher dans une alert Bootstrap
4
* @author jcheron
5
* @version 1.1
6
*/
7
class DisplayedMessage {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
8
	private $content;
9
	private $type;
10
	private $timerInterval;
11
	private $dismissable;
12
	private $visible;
13
	public function DisplayedMessage($content,$type="success",$timerInterval=0,$dismissable=true,$visible=true){
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
14
		$this->content=$content;
15
		$this->type=$type;
16
		$this->dismissable=$dismissable;
17
		$this->timerInterval=$timerInterval;
18
		$this->visible=$visible;
19
	}
20
	public function getContent() {
21
		return $this->content;
22
	}
23
	public function setContent($content) {
24
		$this->content=$content;
25
		return $this;
26
	}
27
	public function getType() {
28
		return $this->type;
29
	}
30
	public function setType($type) {
31
		$this->type=$type;
32
		return $this;
33
	}
34
	public function getTimerInterval() {
35
		return $this->timerInterval;
36
	}
37
	public function setTimerInterval($timerInterval) {
38
		$this->timerInterval=$timerInterval;
39
		return $this;
40
	}
41
	public function getDismissable() {
42
		return $this->dismissable;
43
	}
44
	public function setDismissable($dismissable) {
45
		$this->dismissable=$dismissable;
46
		return $this;
47
	}
48
	public function compile($jquery){
49
		$alert=$jquery->bootstrap()->htmlAlert("message",$this->content,$this->type);
50
		if($this->visible==false){
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
51
			$alert->setProperty("style","display:none;");
52
		}
53
		$alert->setCloseable($this->dismissable);
54
		if(isset($this->timerInterval) && $this->timerInterval>0){
55
			$jquery->hide(".alert",$this->timerInterval,'',true);
56
		}
57
		return $alert->compile($jquery);
58
	}
59
}