1: <?php
2:
3: /**
4: * Copyright 2015, Eduardo Trujillo
5: *
6: * For the full copyright and license information, please view the LICENSE
7: * file that was distributed with this source code.
8: *
9: * This file is part of the Nucleus package
10: */
11:
12: namespace Chromabits\Nucleus\View;
13:
14: use Chromabits\Nucleus\Foundation\BaseObject;
15: use Chromabits\Nucleus\View\Interfaces\RenderableInterface;
16:
17: /**
18: * Class SafeHtmlWrapper.
19: *
20: * WARNING: If you use one of these, you know what you are doing.
21: *
22: * @author Eduardo Trujillo <ed@chromabits.com>
23: * @package Chromabits\Nucleus\View
24: */
25: class SafeHtmlWrapper extends BaseObject implements RenderableInterface
26: {
27: protected $content;
28:
29: /**
30: * Construct an instance of a SafeHtmlWrapper.
31: *
32: * @param string $safeHtml
33: */
34: public function __construct($safeHtml)
35: {
36: parent::__construct();
37:
38: $this->content = (string) $safeHtml;
39: }
40:
41: /**
42: * Render the object into a string.
43: *
44: * @return mixed
45: */
46: public function render()
47: {
48: return $this->content;
49: }
50:
51: /**
52: * Get string representation of this object.
53: *
54: * @return string
55: */
56: public function __toString()
57: {
58: return $this->content;
59: }
60: }
61: