Completed
Push — develop ( f460ca...da25db )
by Stefan
03:10
created

Fill   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 54.55%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 4
c 2
b 1
f 0
lcom 1
cbo 0
dl 0
loc 44
ccs 6
cts 11
cp 0.5455
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setColor() 0 6 1
A setPattern() 0 5 1
A asXml() 0 7 2
1
<?php
2
3
namespace OneSheet\Style;
4
5
use OneSheet\Xml\StyleXml;
6
7
/**
8
 * Class Fill
9
 *
10
 * @package OneSheet
11
 */
12
class Fill
13
{
14
    /**
15
     * @var string
16
     */
17
    private $color;
18
19
    /**
20
     * @var string
21
     */
22
    private $pattern = 'none';
23
24
    /**
25
     * @param string $color
26
     * @return Fill
27
     */
28
    public function setColor($color)
29
    {
30
        $this->color = $color;
31
        $this->pattern = 'solid';
32
        return $this;
33
    }
34
35
    /**
36
     * @param string $pattern
37
     * @return Fill
38
     */
39 2
    public function setPattern($pattern)
40
    {
41 2
        $this->pattern = $pattern;
42 2
        return $this;
43
    }
44
45
    /**
46
     * @return string
47
     */
48 2
    public function asXml()
49
    {
50 2
        if ($this->color) {
51
            return sprintf(StyleXml::COLORED_FILL_XML, $this->color);
52
        }
53 2
        return sprintf(StyleXml::BLANK_FILL_XML, $this->pattern);
54
    }
55
}
56