Passed
Push — master ( cd7b92...8b3dbf )
by Jean-Christophe
03:06
created

BaseWidget::getIdentifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Ajax\common\html;
4
5
use Ajax\service\JString;
6
7
/**
8
 * BaseWidget for Twitter Bootstrap, jQuery UI or Semantic rich components
9
 * @author jc
10
 * @version 1.001
11
 */
12
abstract class BaseWidget {
13
	protected $identifier;
14
	protected $_identifier;
15
	protected $_libraryId;
16
	protected $_self;
17
18
	public function __construct($identifier) {
19
		$this->identifier=$this->cleanIdentifier($identifier);
20
		$this->_identifier=$this->identifier;
21
		$this->_self=$this;
22
	}
23
24
	public function getIdentifier() {
25
		return $this->identifier;
26
	}
27
28
	public function setIdentifier($identifier) {
29
		$this->identifier=$this->cleanIdentifier($identifier);
30
		return $this;
31
	}
32
33
	protected function cleanIdentifier($id) {
34
		return JString::cleanIdentifier($id);
35
	}
36
	/**
37
	 * @return mixed
38
	 */
39
	public function getLibraryId() {
40
		if( isset($this->_libraryId)){
41
			return $this->_libraryId;
42
		}
43
		return $this->identifier;
44
	}
45
46
	/**
47
	 * @param mixed $_libraryId
48
	 */
49
	public function setLibraryId($_libraryId) {
50
		$this->_libraryId = $_libraryId;
51
	}
52
53
}
54