InlineElement::getHtml()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
/**
4
 *  ____  _     _                       _ _
5
 * |  _ \| |__ | |_ ___ _ __ ___   __ _(_) |
6
 * | |_) | '_ \| __/ _ \ '_ ` _ \ / _` | | |
7
 * |  __/| | | | ||  __/ | | | | | (_| | | |
8
 * |_|   |_| |_|\__\___|_| |_| |_|\__,_|_|_|
9
 *
10
 * This file is part of Kristuff\Phtemail.
11
 *
12
 * (c) Kristuff <[email protected]>
13
 *
14
 * For the full copyright and license information, please view the LICENSE
15
 * file that was distributed with this source code.
16
 *
17
 * @version    0.2.0
18
 * @copyright  2017-2020 Kristuff
19
 */
20
21
namespace Kristuff\Phtemail\HtmlElements;
22
23
use Kristuff\Phtemail\Core\HtmlElement;
24
25
/**
26
 * Class InlineElement
27
 * An inline html element that will be rendered 'as is'
28
 */
29
class InlineElement extends HtmlElement
30
{
31
    /**
32
     * @access private
33
     * @var string $htmlContent
34
     */
35
    private $htmlContent = '';
36
37
    /**
38
     * Constructor
39
     * 
40
     * @access public
41
     * @param string    $content    The html content string    
42
     */
43
    public function __construct(string $content)
44
    {
45
        $this->htmlContent = $content;
46
    }
47
    
48
    /** 
49
     * Gets the HTML 
50
     *
51
     * @access public
52
     * @param string    $indent
53
     * 
54
     * @return string
55
     */
56
    public function getHtml(string $indent)
57
    {
58
        $html  = $this->getBuilder()->getHtmlComment('CUSTOM ELEMENT', $indent);
59
        $html .= $indent . $this->htmlContent . PHP_EOL;
60
        return $html;
61
    }
62
}