MixedElement   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getHtml() 0 3 1
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\Core;
22
23
/**
24
 * Represents an html element
25
 */
26
class MixedElement extends \Kristuff\Phtemail\Core\HtmlElement
27
{
28
    /**
29
     * @access protected
30
     * @var string $tag
31
     */
32
    protected $tag = '';
33
34
    /**
35
     * @access protected
36
     * @var string $content
37
     */
38
    protected $content = '';
39
40
    /**
41
     * Constructor
42
     * 
43
     * @access public
44
     * @param string    $tag            The html tag 
45
     * @param string    $content        The element content
46
     * @param array     $styles         The inline styles
47
     */
48
    public function __construct(string $tag, string $content = '', array $styles = [])
49
    {
50
        $this->tag = $tag;
51
        $this->content = $content;
52
        $this->setStyles($styles);
53
    }
54
55
    /** 
56
     * Get the HTML 
57
     *
58
     * @access public
59
     * @param string    $indent
60
     * 
61
     * @return string
62
     */
63
    public function getHtml(string $indent = '')
64
    {
65
        return $indent . '<' . $this->tag . $this->getInlineStyles() .'>' . $this->content. '</' . $this->tag  . '>';
66
    }
67
}