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

BorderBuilder::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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