More adjusted API tests
[dokuwiki.git] / inc / Form / TagCloseElement.php
blob20579a16dccc4423fb55be7b7c40609c3a27fa5a
1 <?php
3 namespace dokuwiki\Form;
5 /**
6 * Class TagCloseElement
8 * Creates an HTML close tag. You have to make sure it has been opened
9 * before or this will produce invalid HTML
11 * @package dokuwiki\Form
13 class TagCloseElement extends ValueElement
15 /**
16 * @param string $tag
17 * @param array $attributes
19 public function __construct($tag, $attributes = [])
21 parent::__construct('tagclose', $tag, $attributes);
24 /**
25 * do not call this
27 * @param string $class
28 * @return void
29 * @throws \BadMethodCallException
31 public function addClass($class)
33 throw new \BadMethodCallException('You can\t add classes to closing tag');
36 /**
37 * do not call this
39 * @param null|string $id
40 * @return string
41 * @throws \BadMethodCallException
43 public function id($id = null)
45 if ($id === null) {
46 return '';
47 } else {
48 throw new \BadMethodCallException('You can\t add ID to closing tag');
52 /**
53 * do not call this
55 * @param string $name
56 * @param null|string $value
57 * @return string
58 * @throws \BadMethodCallException
60 public function attr($name, $value = null)
62 if ($value === null) {
63 return '';
64 } else {
65 throw new \BadMethodCallException('You can\t add attributes to closing tag');
69 /**
70 * do not call this
72 * @param array|null $attributes
73 * @return array
74 * @throws \BadMethodCallException
76 public function attrs($attributes = null)
78 if ($attributes === null) {
79 return [];
80 } else {
81 throw new \BadMethodCallException('You can\t add attributes to closing tag');
85 /**
86 * The HTML representation of this element
88 * @return string
90 public function toHTML()
92 return '</' . $this->val() . '>';