splitbrain /
dokuwiki
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | namespace dokuwiki\Form; |
||
| 3 | |||
| 4 | /** |
||
| 5 | * Class FieldsetOpenElement |
||
| 6 | * |
||
| 7 | * Opens a Fieldset with an optional legend |
||
| 8 | * |
||
| 9 | * @package dokuwiki\Form |
||
| 10 | */ |
||
| 11 | class FieldsetOpenElement extends TagOpenElement { |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @param string $legend |
||
| 15 | * @param array $attributes |
||
| 16 | */ |
||
| 17 | public function __construct($legend='', $attributes = array()) { |
||
| 18 | // this is a bit messy and we just do it for the nicer class hierarchy |
||
| 19 | // the parent would expect the tag in $value but we're storing the |
||
| 20 | // legend there, so we have to set the type manually |
||
| 21 | parent::__construct($legend, $attributes); |
||
| 22 | $this->type = 'fieldsetopen'; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * The HTML representation of this element |
||
| 27 | * |
||
| 28 | * @return string |
||
| 29 | */ |
||
| 30 | public function toHTML() { |
||
| 31 | $html = '<fieldset '.buildAttributes($this->attrs()).'>'; |
||
| 32 | $legend = $this->val(); |
||
| 33 | if($legend) $html .= DOKU_LF.'<legend>'.hsc($legend).'</legend>'; |
||
|
0 ignored issues
–
show
|
|||
| 34 | return $html; |
||
| 35 | } |
||
| 36 | } |
||
| 37 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.