Completed
Push — master ( b9a8b8...3e8704 )
by Jean-Christophe
03:43
created

HtmlBsDoubleElement   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addBadge() 0 6 1
A addLabel() 0 6 1
A addGlyph() 0 6 1
A wrapContentWithGlyph() 0 8 2
1
<?php
2
3
namespace Ajax\bootstrap\html\base;
4
5
use Ajax\bootstrap\html\HtmlBadge;
6
use Ajax\bootstrap\html\HtmlLabel;
7
use Ajax\bootstrap\html\HtmlGlyphicon;
8
use Ajax\common\html\HtmlDoubleElement;
9
10
class HtmlBsDoubleElement extends HtmlDoubleElement {
11
12
	public function addBadge($caption, $leftSeparator="&nbsp;") {
13
		$badge=new HtmlBadge("badge-".$this->identifier, $caption);
14
		$badge->wrap($leftSeparator);
15
		$this->addContent($badge);
16
		return $this;
17
	}
18
19
	public function addLabel($caption, $style="label-default", $leftSeparator="&nbsp;") {
20
		$label=new HtmlLabel("label-".$this->identifier, $caption, $style);
21
		$label->wrap($leftSeparator);
22
		$this->addContent($label);
23
		return $this;
24
	}
25
26
	public function addGlyph($glyphicon,$before=true){
27
		$glyph=new HtmlGlyphicon("");
28
		$glyph->setGlyphicon($glyphicon);
29
		$this->addContent($glyph,$before);
30
		return $this;
31
	}
32
33
	public function wrapContentWithGlyph($glyphBefore,$glyphAfter=""){
34
		$before=HtmlGlyphicon::getGlyphicon($glyphBefore)."&nbsp;";
35
		$after="";
36
		if($glyphAfter!==""){
37
			$after="&nbsp;".HtmlGlyphicon::getGlyphicon($glyphAfter);
38
		}
39
		return $this->wrapContent($before,$after);
40
	}
41
}