CheckableOption   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 4
dl 0
loc 47
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 2
A FieldHolder() 0 4 1
A Message() 0 4 1
A MessageType() 0 4 1
A Title() 0 4 1
A Field() 0 4 1
1
<?php
2
3
class CheckableOption extends CompositeField
4
{
5
    protected $childField, $checkbox;
6
7
    public function __construct($checkName, $childField, $value = "", $readonly = false)
8
    {
9
        $this->name = $checkName;
10
        $this->checkbox = new CheckboxField($checkName, "", $value);
11
        if ($readonly) {
12
            $this->checkbox->setDisabled(true);
13
        }
14
15
        $this->childField = $childField;
16
17
        $children = new FieldList(
18
            $this->childField,
19
            $this->checkbox
20
        );
21
22
        parent::__construct($children);
23
    }
24
25
    public function FieldHolder($properties = array())
26
    {
27
        return FormField::FieldHolder($properties);
28
    }
29
30
    public function Message()
31
    {
32
        return $this->childField->Message();
33
    }
34
35
    public function MessageType()
36
    {
37
        return $this->childField->MessageType();
38
    }
39
40
    public function Title()
41
    {
42
        return $this->childField->Title();
43
    }
44
45
    public function Field($properties = array())
46
    {
47
        return $this->childField->Field() . ' ' . $this->checkbox->Field();
48
    }
49
}
50