Badge::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Roboc\Menu;
4
5
/**
6
 * Class Badge
7
 * @package Roboc\Menu
8
 */
9
class Badge
10
{
11
    /**
12
     * @var string
13
     */
14
    protected $value;
15
16
    /**
17
     * @var array
18
     */
19
    protected $attributes = [ ];
20
21
    /**
22
     * Badge constructor.
23
     * @param $value
24
     * @param array $attributes
25
     */
26
    public function __construct( $value, array $attributes = [ ] )
27
    {
28
        $this->value = $value;
29
        $this->attributes = $attributes;
30
    }
31
32
    /**
33
     * @return string
34
     */
35
    public function __toString()
36
    {
37
        return (string) $this->value;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function value()
44
    {
45
        return $this->value;
46
    }
47
48
    /**
49
     * @return array
50
     */
51
    public function attributes()
52
    {
53
        return $this->attributes;
54
    }
55
}
56