Completed
Push — master ( 226547...612b7b )
by Nathan
02:27
created

HtmlElementInterface.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace NatePage\EasyHtmlElement;
4
5
interface HtmlElementInterface
6
{
7
    /**
8
     * Create a html element.
9
     *
10
     * @param string $type      The element type
11
     * @param string $text      The element text
12
     * @param array $attributes The element attributes
13
     * @param array $children   The element children
14
     *
15
     * @return ElementInterface
16
     */
17
    static public function create($type = null, $text = null, array $attributes = array(), array $children = array());
0 ignored issues
show
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
18
19
    /**
20
     * Load a html element.
21
     *
22
     * @param string $name      The element name
23
     * @param array $parameters The element parameters
24
     * @param array $attributes The element attributes
25
     * @param array $children   The element children
26
     *
27
     * @return ElementInterface
28
     */
29
    public function load($name, array $parameters = array(), array $attributes = array(), array $children = array());
30
31
    /**
32
     * Check if an element exits.
33
     *
34
     * @param string $name The element name
35
     *
36
     * @return bool
37
     */
38
    public function exists($name);
39
40
    /**
41
     * Set the elements map.
42
     *
43
     * @param array $map The elements map
44
     *
45
     * @return HtmlElementInterface
46
     */
47
    public function setMap(array $map);
48
49
    /**
50
     * Get the elements map.
51
     *
52
     * @return array
53
     */
54
    public function getMap();
55
56
    /**
57
     * Add one element to the map.
58
     *
59
     * @param string $name   The element name
60
     * @param array $element The element array to add
61
     *
62
     * @return HtmlElementInterface
63
     */
64
    public function addOneToMap($name, array $element);
65
66
    /**
67
     * Add many elements to the map.
68
     *
69
     * @param array $elements The elements to add
70
     *
71
     * @return HtmlElementInterface
72
     */
73
    public function addManyToMap(array $elements);
74
75
    /**
76
     * Set the HtmlElement escaper.
77
     *
78
     * @param EscaperInterface $escaper The escaper to set
79
     *
80
     * @return HtmlElementInterface
81
     */
82
    public function setEscaper(EscaperInterface $escaper);
83
84
    /**
85
     * Get the HtmlElement escaper.
86
     *
87
     * @return EscaperInterface
88
     */
89
    public function getEscaper();
90
91
    /**
92
     * Apply escaping strategies to an element.
93
     *
94
     * @param ElementInterface $element The element to escape
95
     *
96
     * @return ElementInterface
97
     */
98
    public function escape(ElementInterface $element);
99
100
    /**
101
     * Apply escaping strategies on element attributes.
102
     *
103
     * @param array $attributes The attributes array to escape
104
     *
105
     * @return array
106
     */
107
    public function escapeAttributes(array $attributes);
108
109
    /**
110
     * Determine if html is escaped or not
111
     *
112
     * @param bool $escapeHtml
113
     *
114
     * @return HtmlElementInterface
115
     */
116
    public function setEscapeHtml($escapeHtml = true);
117
118
    /**
119
     * Get the html escaping strategy.
120
     *
121
     * @return bool
122
     */
123
    public function isEscapeHtml();
124
125
    /**
126
     * Determine if html attributes are escaped or not
127
     *
128
     * @param bool $escapeHtmlAttr
129
     *
130
     * @return HtmlElementInterface
131
     */
132
    public function setEscapeHtmlAttr($escapeHtmlAttr = true);
133
134
    /**
135
     * Get the html attributes escaping strategy.
136
     *
137
     * @return bool
138
     */
139
    public function isEscapeHtmlAttr();
140
141
    /**
142
     * Determine if javascript is escaped or not
143
     *
144
     * @param bool $escapeJs
145
     *
146
     * @return HtmlElementInterface
147
     */
148
    public function setEscapeJs($escapeJs = true);
149
150
    /**
151
     * Get the javascript escaping strategy.
152
     *
153
     * @return bool
154
     */
155
    public function isEscapeJs();
156
157
    /**
158
     * Determine if css is escaped or not
159
     *
160
     * @param bool $escapeCss
161
     *
162
     * @return HtmlElementInterface
163
     */
164
    public function setEscapeCss($escapeCss = true);
165
166
    /**
167
     * Get the css escaping strategy.
168
     *
169
     * @return bool
170
     */
171
    public function isEscapeCss();
172
173
    /**
174
     * Determine if urls are escaped or not
175
     *
176
     * @param bool $escapeUrl
177
     *
178
     * @return HtmlElementInterface
179
     */
180
    public function setEscapeUrl($escapeUrl = true);
181
182
    /**
183
     * Get the urls escaping strategy.
184
     *
185
     * @return bool
186
     */
187
    public function isEscapeUrl();
188
}
189