| 1 |
<?php |
| 2 |
|
| 3 |
namespace OOUI; |
| 4 |
|
| 5 |
/** |
| 6 |
* Wraps a HTML snippet for use with Tag::appendContent() and Tag::prependContent(). |
| 7 |
*/ |
| 8 |
class HtmlSnippet { |
| 9 |
|
| 10 |
/* Properties */ |
| 11 |
|
| 12 |
/** |
| 13 |
* HTML snippet this instance represents. |
| 14 |
* |
| 15 |
* @var string |
| 16 |
*/ |
| 17 |
protected $content; |
| 18 |
|
| 19 |
/* Methods */ |
| 20 |
|
| 21 |
/** |
| 22 |
* @param string $content HTML snippet |
| 23 |
* @param-taint $content exec_html |
| 24 |
*/ |
| 25 |
public function __construct( $content ) { |
| 26 |
if ( !is_string( $content ) ) { |
| 27 |
throw new Exception( 'Content passed to HtmlSnippet must be a string' ); |
| 28 |
} |
| 29 |
$this->content = $content; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Render into HTML. |
| 34 |
* |
| 35 |
* @return string Unchanged HTML snippet |
| 36 |
*/ |
| 37 |
public function __toString() { |
| 38 |
return $this->content; |
| 39 |
} |
| 40 |
} |