Passed
Push — master ( 689ec5...45f08c )
by Sebastian
05:26
created

Traits_Stylable::styleAuto()   A

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
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AppUtils;
6
7
trait Traits_Stylable
8
{
9
    abstract public function getStyles() : StyleCollection;
10
11
    public function hasStyles() : bool
12
    {
13
        return $this->getStyles()->hasStyles();
14
    }
15
16
    /**
17
     * @param string $name
18
     * @param string $value
19
     * @param bool $important
20
     * @return $this
21
     */
22
    public function style(string $name, string $value, bool $important)
23
    {
24
        $this->getStyles()->style($name, $value, $important);
25
        return $this;
26
    }
27
28
    /**
29
     * @param string $name
30
     * @param string|number|NumberInfo|Interface_Stringable|NULL $value
31
     * @param bool $important
32
     * @return $this
33
     */
34
    public function styleAuto(string $name, $value, bool $important)
35
    {
36
        $this->getStyles()->styleAuto($name, $value, $important);
37
        return $this;
38
    }
39
40
    /**
41
     * @param string $name
42
     * @return $this
43
     */
44
    public function removeStyle(string $name)
45
    {
46
        $this->getStyles()->remove($name);
47
        return $this;
48
    }
49
}
50