summaryrefslogtreecommitdiff
path: root/platform/www/inc/Form/TagCloseElement.php
diff options
context:
space:
mode:
Diffstat (limited to 'platform/www/inc/Form/TagCloseElement.php')
-rw-r--r--platform/www/inc/Form/TagCloseElement.php88
1 files changed, 88 insertions, 0 deletions
diff --git a/platform/www/inc/Form/TagCloseElement.php b/platform/www/inc/Form/TagCloseElement.php
new file mode 100644
index 0000000..b6bf753
--- /dev/null
+++ b/platform/www/inc/Form/TagCloseElement.php
@@ -0,0 +1,88 @@
+<?php
+namespace dokuwiki\Form;
+
+/**
+ * Class TagCloseElement
+ *
+ * Creates an HTML close tag. You have to make sure it has been opened
+ * before or this will produce invalid HTML
+ *
+ * @package dokuwiki\Form
+ */
+class TagCloseElement extends ValueElement {
+
+ /**
+ * @param string $tag
+ * @param array $attributes
+ */
+ public function __construct($tag, $attributes = array()) {
+ parent::__construct('tagclose', $tag, $attributes);
+ }
+
+ /**
+ * do not call this
+ *
+ * @param string $class
+ * @return void
+ * @throws \BadMethodCallException
+ */
+ public function addClass($class) {
+ throw new \BadMethodCallException('You can\t add classes to closing tag');
+ }
+
+ /**
+ * do not call this
+ *
+ * @param null|string $id
+ * @return string
+ * @throws \BadMethodCallException
+ */
+ public function id($id = null) {
+ if ($id === null) {
+ return '';
+ } else {
+ throw new \BadMethodCallException('You can\t add ID to closing tag');
+ }
+ }
+
+ /**
+ * do not call this
+ *
+ * @param string $name
+ * @param null|string $value
+ * @return string
+ * @throws \BadMethodCallException
+ */
+ public function attr($name, $value = null) {
+ if ($value === null) {
+ return '';
+ } else {
+ throw new \BadMethodCallException('You can\t add attributes to closing tag');
+ }
+ }
+
+ /**
+ * do not call this
+ *
+ * @param array|null $attributes
+ * @return array
+ * @throws \BadMethodCallException
+ */
+ public function attrs($attributes = null) {
+ if ($attributes === null) {
+ return array();
+ } else {
+ throw new \BadMethodCallException('You can\t add attributes to closing tag');
+ }
+ }
+
+ /**
+ * The HTML representation of this element
+ *
+ * @return string
+ */
+ public function toHTML() {
+ return '</'.$this->val().'>';
+ }
+
+}