Completed
Push — prototype ( 3bfdd7...aec713 )
by Peter
07:47
created

FieldSet::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Webino (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino for the canonical source repository
6
 * @copyright   Copyright (c) 2015-2017 Webino, s.r.o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
11
namespace WebinoHtmlLib\Html;
12
13
/**
14
 * Class FieldSet
15
 */
16
class FieldSet extends AbstractHtml
17
{
18
    /**
19
     * @var string
20
     */
21
    private $legend;
22
23
    /**
24
     * @param string $legend
25
     * @param string|array|HtmlInterface $value
26
     */
27
    public function __construct($legend, $value)
28
    {
29
        $this->legend = $legend;
30
        $this->setValue($value);
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    protected function getTagName()
37
    {
38
        return 'FieldSet';
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    protected function toStringInternal($tag, $attribs, $value)
45
    {
46
        return sprintf('<%s %s><legend>%s</legend>%s</%s>', $tag, $attribs, $this->legend, $value, $tag);
47
    }
48
}
49