Completed
Push — master ( 7089ac...364809 )
by Jean-Christophe
03:53
created

CheckboxTrait::getHtmlCk()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Ajax\semantic\html\collections\form\traits;
4
5
use Ajax\semantic\html\base\constants\CheckboxType;
6
7
trait CheckboxTrait {
8
9
	public abstract function addToPropertyCtrl($name, $value, $typeCtrl);
10
11
	public function setType($checkboxType) {
12
		return $this->addToPropertyCtrl("class", $checkboxType, CheckboxType::getConstants());
13
	}
14
15
	/**
16
	 * Attach $this to $selector and fire $action
17
	 * @param string $selector jquery selector of the associated element
18
	 * @param string $action action to execute : check, uncheck or NULL for toggle
19
	 * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox
20
	 */
21
	public function attachEvent($selector, $action=NULL) {
22
		return $this->getHtmlCk()->attachEvent($selector, $action);
23
	}
24
25
	/**
26
	 * Attach $this to an array of $action=>$selector
27
	 * @param array $events associative array of events to attach ex : ["#bt-toggle","check"=>"#bt-check","uncheck"=>"#bt-uncheck"]
28
	 * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox
29
	 */
30
	public function attachEvents($events=array()) {
31
		return $this->getHtmlCk()->attachEvents($events);
32
	}
33
34
	public function getField(){
35
		return $this->content["field"]->getField();
0 ignored issues
show
Bug introduced by
The property content does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
36
	}
37
	
38
	public function getHtmlCk(){
39
		return $this->content["field"];
40
	}
41
	
42
}