Completed
Push — master ( 79b035...e37d9a )
by Jean-Christophe
03:44
created

SemanticHtmlElementsTrait::htmlSegmentGroups()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
namespace Ajax\semantic\traits;
3
4
use Ajax\semantic\html\elements\HtmlButtonGroups;
5
use Ajax\semantic\html\elements\HtmlButton;
6
use Ajax\semantic\html\elements\HtmlContainer;
7
use Ajax\semantic\html\elements\HtmlDivider;
8
use Ajax\semantic\html\elements\HtmlHeader;
9
use Ajax\semantic\html\elements\HtmlIcon;
10
use Ajax\semantic\html\elements\HtmlIconGroups;
11
use Ajax\semantic\html\elements\HtmlInput;
12
use Ajax\semantic\html\elements\HtmlLabel;
13
use Ajax\semantic\html\elements\HtmlList;
14
use Ajax\semantic\html\elements\HtmlSegment;
15
use Ajax\semantic\html\elements\HtmlSegmentGroups;
16
use Ajax\service\JArray;
17
18
19
trait SemanticHtmlElementsTrait {
20
	/**
21
	 * Return a new Semantic Html Button
22
	 * @param string $identifier
23
	 * @param string $value
24
	 * @param string $cssStyle
25
	 * @param string $onClick
26
	 * @return HtmlButton
27
	 */
28
	public function htmlButton($identifier, $value="", $cssStyle=null, $onClick=null) {
29
		return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick));
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
30
	}
31
32
	/**
33
	 * @param string $identifier
34
	 * @param array $elements
35
	 * @param boolean $asIcons
36
	 * @return HtmlButtonGroups
37
	 */
38
	public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){
39
		return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons));
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
40
	}
41
42
	/**
43
	 * Creates an html container
44
	 * @param string $identifier
45
	 * @param string $content
46
	 * @return HtmlContainer
47
	 */
48
	public function htmlContainer($identifier,$content=""){
49
		return $this->addHtmlComponent(new HtmlContainer($identifier, $content));
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
50
	}
51
52
	/**
53
	 * @param string $identifier
54
	 * @param string $content
55
	 * @return HtmlDivider
56
	 */
57
	public function htmlDivider($identifier,$content="",$tagName="div"){
58
		return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName));
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
59
	}
60
61
	/**
62
	 * @param string $identifier
63
	 * @param number $niveau
64
	 * @param mixed $content
65
	 * @param string $type
66
	 * @return HtmlHeader
67
	 */
68
	public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){
69
		return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type));
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
70
	}
71
72
	/**
73
	 * @param string $identifier
74
	 * @param string $icon
75
	 * @return HtmlIcon
76
	 */
77
	public function htmlIcon($identifier,$icon){
78
		return $this->addHtmlComponent(new HtmlIcon($identifier, $icon));
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
79
	}
80
81
	/**
82
	 * @param string $identifier
83
	 * @param string $size
84
	 * @param array $icons
85
	 * @return HtmlIconGroups
86
	 */
87
	public function htmlIconGroups($identifier,$size="",$icons=array()){
88
		$group=new HtmlIconGroups($identifier,$size);
89
		if(JArray::isAssociative($icons)){
90
			foreach ($icons as $icon=>$size){
91
				$group->add($icon,$size);
92
			}
93
		}else{
94
			foreach ($icons as $icon){
95
				$group->add($icon);
96
			}
97
		}
98
		return $this->addHtmlComponent($group);
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
99
	}
100
101
	/**
102
	 *
103
	 * @param string $identifier
104
	 * @param string $type
105
	 * @param string $value
106
	 * @param string $placeholder
107
	 * @return HtmlInput
108
	 */
109
	public function htmlInput($identifier,$type="text",$value="",$placeholder=""){
110
		return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder));
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
111
	}
112
113
	/**
114
	 * @param string $identifier
115
	 * @param string $content
116
	 * @param string $tagName
117
	 * @return HtmlLabel
118
	 */
119
	public function htmlLabel($identifier,$content="",$tagName="div"){
120
		return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName));
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
121
	}
122
123
	/**
124
	 *
125
	 * @param string $identifier
126
	 * @param array $items
127
	 * @return HtmlList
128
	 */
129
	public function htmlList($identifier,$items=array()){
130
		return $this->addHtmlComponent(new HtmlList($identifier,$items));
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
131
	}
132
133
	/**
134
	 * Adds a new segment, used to create a grouping of related content
135
	 * @param string $identifier
136
	 * @param string $content
137
	 * @return HtmlSegment
138
	 */
139
	public function htmlSegment($identifier, $content=""){
140
		return $this->addHtmlComponent(new HtmlSegment($identifier,$content));
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
141
	}
142
143
	/**
144
	 * Adds a group of segments
145
	 * @param string $identifier
146
	 * @param array $items the segments
147
	 * @return HtmlSegmentGroups
148
	 */
149
	public function htmlSegmentGroups($identifier, $items=array()){
150
		return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items));
0 ignored issues
show
Bug introduced by
It seems like addHtmlComponent() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
151
	}
152
}