Failed Conditions
Pull Request — master (#200)
by Hura
03:45 queued 01:12
created

BorderBuilder   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 68
ccs 0
cts 28
cp 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setBorderTop() 0 5 1
A setBorderRight() 0 5 1
A setBorderBottom() 0 5 1
A setBorderLeft() 0 5 1
A build() 0 4 1
1
<?php
2
3
namespace Box\Spout\Writer\Style;
4
5
/**
6
 * Class BorderBuilder
7
 */
8
class BorderBuilder
9
{
10
    /**
11
     * @var Border
12
     */
13
    protected $border;
14
15
    public function __construct()
16
    {
17
        $this->border = new Border();
18
    }
19
20
    /**
21
     * @param string $style Border style @see BorderPart::allowedStyles
22
     * @param string $color Border A RGB color code
23
     * @param string $width Border width @see BorderPart::allowedWidths
24
     * @return self
25
     */
26
    public function setBorderTop($style = Border::STYLE_SOLID, $color = Color::BLACK, $width = Border::WIDTH_THICK)
27
    {
28
        $this->border->addPart(new BorderPart(Border::TOP, $style, $color, $width));
29
        return $this;
30
    }
31
32
    /**
33
     * @param string $style Border style @see BorderPart::allowedStyles
34
     * @param string $color Border A RGB color code
35
     * @param string $width Border width @see BorderPart::allowedWidths
36
     * @return self
37
     */
38
    public function setBorderRight($style = Border::STYLE_SOLID, $color = Color::BLACK, $width = Border::WIDTH_THICK)
39
    {
40
        $this->border->addPart(new BorderPart(Border::RIGHT, $style, $color, $width));
41
        return $this;
42
    }
43
44
    /**
45
     * @param string $style Border style @see BorderPart::allowedStyles
46
     * @param string $color Border A RGB color code
47
     * @param string $width Border width @see BorderPart::allowedWidths
48
     * @return self
49
     */
50
    public function setBorderBottom($style = Border::STYLE_SOLID, $color = Color::BLACK, $width = Border::WIDTH_THICK)
51
    {
52
        $this->border->addPart(new BorderPart(Border::BOTTOM, $style, $color, $width));
53
        return $this;
54
    }
55
56
    /**
57
     * @param string $style Border style @see BorderPart::allowedStyles
58
     * @param string $color Border A RGB color code
59
     * @param string $width Border width @see BorderPart::allowedWidths
60
     * @return self
61
     */
62
    public function setBorderLeft($style = Border::STYLE_SOLID, $color = Color::BLACK, $width = Border::WIDTH_THICK)
63
    {
64
        $this->border->addPart(new BorderPart(Border::LEFT, $style, $color, $width));
65
        return $this;
66
    }
67
68
    /**
69
     * @return Border
70
     */
71
    public function build()
72
    {
73
        return $this->border;
74
    }
75
}
76