Completed
Push — master ( d86df2...153cd3 )
by Adam
11s
created

Override   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 38
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
attribute() 0 1 ?
A data() 0 5 2
A acceptcharset() 0 4 1
A contentAttribute() 0 4 1
1
<?php
2
3
namespace BestServedCold\HTMLBuilder\Html\Node;
4
5
use BestServedCold\HTMLBuilder\Html\Node;
6
7
/**
8
 * Class Override
9
 * 
10
 * @package BestServedCold\HTMLBuilder\Html\Node
11
 */
12
trait Override
13
{
14
    /**
15
     * @param  $type
16
     * @param  $string
17
     * @return Node
18
     */
19
    public abstract function attribute($type, $string);
20
21
    /**
22
     * @param string        $string
23
     * @param string|null   $type
24
     * @return Node
25
     */
26 1
    public function data($string, $type = null)
27
    {
28 1
        $type = $type ? 'data-' . $type : 'data';
29 1
        return $this->attribute($type, $string);
30
    }
31
32
    /**
33
     * @param  string|null $string
34
     * @return Node
35
     */
36 1
    public function acceptcharset($string = null)
37
    {
38 1
        return $this->attribute('accept-charset', $string);
39
    }
40
41
    /**
42
     * @param null $value
43
     * @return Node
44
     */
45 1
    public function contentAttribute($value = null)
46
    {
47 1
        return $this->attribute('content', $value);
48
    }
49
}
50