xref: /dokuwiki/inc/Form/TagCloseElement.php (revision 937959a1cc835709ee811f78c86d1fc28f07b74e)
1<?php
2namespace dokuwiki\Form;
3
4/**
5 * Class TagCloseElement
6 *
7 * Creates an HTML close tag. You have to make sure it has been opened
8 * before or this will produce invalid HTML
9 *
10 * @package dokuwiki\Form
11 */
12class TagCloseElement extends ValueElement {
13
14    /**
15     * @param string $tag
16     * @param array $attributes
17     */
18    public function __construct($tag, $attributes = array()) {
19        parent::__construct('tagclose', $tag, $attributes);
20    }
21
22    /**
23     * do not call this
24     *
25     * @param $class
26     * @return void
27     * @throws \BadMethodCallException
28     */
29    public function addClass($class) {
30        throw new \BadMethodCallException('You can\t add classes to closing tag');
31    }
32
33    /**
34     * do not call this
35     *
36     * @param $id
37     * @return void
38     * @throws \BadMethodCallException
39     */
40    public function id($id = null) {
41        throw new \BadMethodCallException('You can\t add ID to closing tag');
42    }
43
44    /**
45     * do not call this
46     *
47     * @param $name
48     * @param $value
49     * @return void
50     * @throws \BadMethodCallException
51     */
52    public function attr($name, $value = null) {
53        throw new \BadMethodCallException('You can\t add attributes to closing tag');
54    }
55
56    /**
57     * do not call this
58     *
59     * @param $attributes
60     * @return void
61     * @throws \BadMethodCallException
62     */
63    public function attrs($attributes = null) {
64        throw new \BadMethodCallException('You can\t add attributes to closing tag');
65    }
66
67    /**
68     * The HTML representation of this element
69     *
70     * @return string
71     */
72    public function toHTML() {
73        return '</'.$this->val().'>';
74    }
75
76}
77