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

HtmlBsDoubleElement::wrapContentWithGlyph()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 6
nc 2
nop 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
}