-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeader.php
executable file
·111 lines (84 loc) · 2.28 KB
/
Header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
namespace Onimla\SemanticUI;
use Onimla\HTML\Heading;
use Onimla\HTML\Element;
use Onimla\SemanticUI\Header\Sub;
/**
* @property Header\Sub $sub .sub.header
*/
class Header extends Heading {
/**
* @var Icon
*/
protected $icon;
use Traits\Alignment,
Traits\Attached,
Traits\Component,
Traits\Colored,
Traits\Size;
public function __construct($number, $text = FALSE, $class = FALSE) {
parent::__construct($number, $text, $class);
$this->setComponent();
$this->addClass(Constant::HEADER);
}
public function dividing() {
return $this->getClassAttribute()->before(Constant::HEADER, __FUNCTION__);
}
public function block() {
return $this->getClassAttribute()->before(Constant::HEADER, __FUNCTION__);
}
public function setSub($text) {
$this->removeSub();
if ($text instanceof Element) {
$this->sub = $text;
} else {
$this->sub = new Sub($text);
}
}
public function removeSub() {
if (isset($this->sub)) {
$sub = $this->sub;
$this->removeChild($this->sub);
return $sub;
}
return FALSE;
}
public function unsetSub() {
return $this->removeSub();
}
public function sub($text = FALSE) {
if ($text === FALSE) {
return isset($this->sub) ? $this->sub : FALSE;
}
$this->setSub($text);
return $this;
}
public function removeIcon() {
return $this->unsetIcon();
}
public function unsetIcon() {
if ($this->icon === NULL) {
return FALSE;
}
$this->removeChild($this->icon);
$icon = $this->icon;
$this->icon = NULL;
return $icon;
}
public function setIcon($instance) {
if ($instance instanceof Icon) {
$this->icon = $instance;
} else {
$this->icon = new Icon($instance);
}
$this->unsetIcon();
$this->prepend($this->icon);
}
public function icon($instance = FALSE) {
if ($instance === FALSE) {
return $this->icon instanceof Icon ? $this->icon : FALSE;
}
$this->setIcon($instance);
return $this;
}
}