Failed Conditions
Push — perf-tests ( 2fc93e...db6806 )
by Adrien
13:45
created

Border   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 60
rs 10

4 Methods

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