Skip to content

Commit a66f759

Browse files
Merge pull request #14 from dutchenkoOleg/master
htmlOpenTag and htmlCloseTag
2 parents bfd2c71 + da84625 commit a66f759

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

src/WezomAgency/R2D2.php

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,29 +234,43 @@ protected function getNonRepeatingId ($id, $number = null) {
234234
* @param string $id
235235
* @return string
236236
*/
237-
public function nonRepeatingId($id) {
237+
public function nonRepeatingId ($id) {
238238
return $this->getNonRepeatingId($id);
239239
}
240240

241241
/**
242242
* @param string $tag
243243
* @param array $attrs
244-
* @param array $html
245-
* @param bool $closeTag
246244
* @return string
247245
*/
248-
public function htmlElement ($tag, $attrs = [], $html = [], $closeTag = true) {
249-
$element = '';
246+
public function htmlOpenTag (string $tag, $attrs = []) {
250247
if (count($attrs)) {
251-
$element = '<' . $tag . ' ' . $this->attrs($attrs) . '>';
252-
} else {
253-
$element = '<' . $tag . '>';
248+
return '<' . $tag . ' ' . $this->attrs($attrs) . '>';
254249
}
250+
return '<' . $tag . '>';
251+
}
255252

253+
/**
254+
* @param string $tag
255+
* @return string
256+
*/
257+
public function htmlCloseTag (string $tag)
258+
{
259+
return '</' . $tag . '>';
260+
}
261+
262+
/**
263+
* @param string $tag
264+
* @param array $attrs
265+
* @param array $html
266+
* @param bool $closeTag
267+
* @return string
268+
*/
269+
public function htmlElement (string $tag, $attrs = [], $html = [], $closeTag = true) {
256270
if ($closeTag) {
257-
$element = $element . implode(' ', $html) . '</' . $tag . '>';
271+
return $this->htmlOpenTag($tag, $attrs) . implode(' ', $html) . $this->htmlCloseTag($tag);
258272
}
259-
return $element;
273+
return $this->htmlOpenTag($tag, $attrs);
260274
}
261275

262276
/**

0 commit comments

Comments
 (0)