Completed
Push — master ( abc246...138cdf )
by Jean-Christophe
03:36
created

DeInstanceViewer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getValue() 0 9 2
1
<?php
2
3
namespace Ajax\semantic\widgets\dataelement;
4
5
use Ajax\semantic\widgets\base\InstanceViewer;
6
use Ajax\semantic\html\collections\form\HtmlFormField;
7
use Ajax\semantic\html\base\HtmlSemDoubleElement;
8
9
class DeInstanceViewer extends InstanceViewer {
10
11
	public function __construct($identifier, $instance=NULL, $captions=NULL) {
12
		parent::__construct($identifier, $instance, $captions);
13
	}
14
15
	public function getValue($index){
16
		$result=parent::getValue($index);
17
		if($result instanceof HtmlFormField){
18
			$lbl=new HtmlSemDoubleElement("lbl-".$this->widgetIdentifier."-".$index,"label","",$this->getCaption($index));
19
			$lbl->setProperty("for", $result->getDataField()->getIdentifier());
20
			$this->captions[$index]=$lbl;
21
		}
22
		return $result;
23
	}
24
}