Completed
Pull Request — master (#200)
by Hura
11:35
created

Border::getParts()   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
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Box\Spout\Writer\Style;
4
5
class Border
6
{
7
    const LEFT = 'left';
8
    const RIGHT = 'right';
9
    const TOP = 'top';
10
    const BOTTOM = 'bottom';
11
12
    const STYLE_NONE = 'none';
13
    const STYLE_SOLID = 'solid';
14
    const STYLE_DASHED = 'dashed';
15
    const STYLE_DOTTED = 'dotted';
16
    const STYLE_DOUBLE = 'double';
17
18
    const WIDTH_THIN = 'thin';
19
    const WIDTH_MEDIUM = 'medium';
20
    const WIDTH_THICK = 'thick';
21
22
    /**
23
     * @var array A list of BorderPart objects for this border.
24
     */
25
    protected $parts = [];
26
27
    /**
28
     * @param array $borderParts
29
     */
30
    public function __construct(array $borderParts = [])
31
    {
32
        $this->setParts($borderParts);
33
    }
34
35
    /**
36
     * @return array
37
     */
38
    public function getParts()
39
    {
40
        return $this->parts;
41
    }
42
43
    /**
44
     * Set BorderParts
45
     * @param array $parts
46
     */
47
    public function setParts($parts)
48
    {
49
        unset($this->parts);
50
        foreach ($parts as $part) {
51
            $this->addPart($part);
52
        }
53
    }
54
55
    /**
56
     * @param BorderPart $borderPart
57
     * @return self
58
     */
59
    public function addPart(BorderPart $borderPart)
60
    {
61
        $this->parts[$borderPart->getName()] = $borderPart;
62
        return $this;
63
    }
64
}
65