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 string 38 * @throws \BadMethodCallException 39 */ 40 public function id($id = null) { 41 if ($id === null) { 42 return ''; 43 } else { 44 throw new \BadMethodCallException('You can\t add ID to closing tag'); 45 } 46 } 47 48 /** 49 * do not call this 50 * 51 * @param $name 52 * @param $value 53 * @return string 54 * @throws \BadMethodCallException 55 */ 56 public function attr($name, $value = null) { 57 if ($value === null) { 58 return ''; 59 } else { 60 throw new \BadMethodCallException('You can\t add attributes to closing tag'); 61 } 62 } 63 64 /** 65 * do not call this 66 * 67 * @param $attributes 68 * @return array 69 * @throws \BadMethodCallException 70 */ 71 public function attrs($attributes = null) { 72 if ($attributes === null) { 73 return array(); 74 } else { 75 throw new \BadMethodCallException('You can\t add attributes to closing tag'); 76 } 77 } 78 79 /** 80 * The HTML representation of this element 81 * 82 * @return string 83 */ 84 public function toHTML() { 85 return '</'.$this->val().'>'; 86 } 87 88} 89