Test Failed
Push — rendered-cell-sizes ( 8ba9d2 )
by Stefan
03:31
created

Font::isBold()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace OneSheet\Style;
4
5
use OneSheet\Xml\StyleXml;
6
7
/**
8
 * Class Font
9
 *
10
 * @package OneSheet
11
 */
12
class Font implements Component
13
{
14
    /**
15
     * @var int
16
     */
17
    private $id;
18
19
    /**
20
     * @var string
21
     */
22
    private $italic;
23
24
    /**
25
     * @var string
26
     */
27
    private $underline;
28
29
    /**
30
     * @var string
31
     */
32
    private $bold;
33
34
    /**
35
     * @var string
36
     */
37
    private $strikethrough;
38
39
    /**
40
     * @var string
41
     */
42
    private $name = 'Calibri';
43
44
    /**
45
     * @var int
46
     */
47
    private $size = 11;
48
49
    /**
50
     * @var string
51
     */
52
    private $color = '000000';
53
54
    /**
55
     * @param int $id
56
     * @return Font
57
     */
58
    public function setId($id)
59
    {
60
        $this->id = $id;
61
        return $this;
62
    }
63
64
    /**
65
     * @return int
66
     */
67
    public function getId()
68
    {
69
        return $this->id;
70
    }
71
72
    /**
73
     * @return Font
74
     */
75
    public function setItalic()
76
    {
77
        $this->italic = '<i/>';
78
        return $this;
79
    }
80
81
    /**
82
     * @return Font
83
     */
84
    public function setUnderline()
85
    {
86
        $this->underline = '<u/>';
87
        return $this;
88
    }
89
90
    /**
91
     * @return Font
92
     */
93
    public function setBold()
94
    {
95
        $this->bold = '<b/>';
96
        return $this;
97
    }
98
99
    /**
100
     * @return Font
101
     */
102
    public function setStrikethrough()
103
    {
104
        $this->strikethrough = '<strike/>';
105
        return $this;
106
    }
107
108
    /**
109
     * @return string
110
     */
111
    public function getName()
112
    {
113
        return $this->name;
114
    }
115
116
    /**
117
     * @param string $name
118
     * @return Font
119
     */
120
    public function setName($name)
121
    {
122
        $this->name = $name;
123
        return $this;
124
    }
125
126
    /**
127
     * @return int
128
     */
129
    public function getSize()
130
    {
131
        return $this->size;
132
    }
133
134
    /**
135
     * @param int $size
136
     * @return Font
137
     */
138
    public function setSize($size)
139
    {
140
        $this->size = $size;
141
        return $this;
142
    }
143
144
    /**
145
     * @param string $color
146
     * @return Font
147
     */
148
    public function setColor($color)
149
    {
150
        $this->color = strtoupper($color);
151
        return $this;
152
    }
153
154
    /**
155
     * @return string
156
     */
157
    public function asXml()
158
    {
159
        return sprintf(
160
            StyleXml::FONT_DEFAULT_XML,
161
            $this->size,
162
            $this->color,
163
            $this->name,
164
            $this->bold,
165
            $this->italic,
166
            $this->underline,
167
            $this->strikethrough
168
        );
169
    }
170
}
171