Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
30 / 30
100.00% covered (success)
100.00%
16 / 16
CRAP
100.00% covered (success)
100.00%
1 / 1
Outline
100.00% covered (success)
100.00%
30 / 30
100.00% covered (success)
100.00%
16 / 16
16
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUnit
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getWeight
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setWeight
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getColor
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setColor
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getDash
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setDash
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getLine
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setLine
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 getEndCap
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setEndCap
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getStartArrow
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setStartArrow
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 getEndArrow
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setEndArrow
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * This file is part of PHPWord - A pure PHP library for reading and writing
4 * word processing documents.
5 *
6 * PHPWord is free software distributed under the terms of the GNU Lesser
7 * General Public License version 3 as published by the Free Software Foundation.
8 *
9 * For the full copyright and license information, please read the LICENSE
10 * file that was distributed with this source code. For the full list of
11 * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
12 *
13 * @see         https://github.com/PHPOffice/PHPWord
14 *
15 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16 */
17
18namespace PhpOffice\PhpWord\Style;
19
20/**
21 * Outline defines the line/border of the object.
22 *
23 * @see  http://www.schemacentral.com/sc/ooxml/t-v_CT_Stroke.html
24 * @see  http://www.w3.org/TR/1998/NOTE-VML-19980513#_Toc416858395
25 * @since 0.12.0
26 */
27class Outline extends AbstractStyle
28{
29    /**
30     * Line style constants.
31     *
32     * @see  http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeLineStyle.html
33     *
34     * @const string
35     */
36    const LINE_SINGLE = 'single';
37    const LINE_THIN_THIN = 'thinThin';
38    const LINE_THIN_THICK = 'thinThick';
39    const LINE_THICK_THIN = 'thickThin';
40    const LINE_THICK_BETWEEN_THIN = 'thickBetweenThin';
41
42    /**
43     * Line style constants.
44     *
45     * @see  http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html
46     *
47     * @const string
48     */
49    const ENDCAP_FLAT = 'flat';
50    const ENDCAP_SQUARE = 'square';
51    const ENDCAP_ROUND = 'round';
52
53    /**
54     * Arrowhead type constants.
55     *
56     * @see  http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeArrowType.html
57     *
58     * @const string
59     */
60    const ARROW_NONE = 'none';
61    const ARROW_BLOCK = 'block';
62    const ARROW_CLASSIC = 'classic';
63    const ARROW_OVAL = 'oval';
64    const ARROW_DIAMOND = 'diamond';
65    const ARROW_OPEN = 'open';
66
67    /**
68     * Unit; No set method for now.
69     *
70     * @var string
71     */
72    private $unit = 'pt';
73
74    /**
75     * Outline weight.
76     *
77     * @var float|int
78     */
79    private $weight;
80
81    /**
82     * Outline color.
83     *
84     * @var string
85     */
86    private $color;
87
88    /**
89     * Dash type.
90     *
91     * @var string
92     */
93    private $dash;
94
95    /**
96     * Line style.
97     *
98     * @var string
99     */
100    private $line;
101
102    /**
103     * End cap.
104     *
105     * @var string
106     *
107     * @see  http://www.schemacentral.com/sc/ooxml/t-v_ST_StrokeEndCap.html
108     */
109    private $endCap;
110
111    /**
112     * Start arrow type.
113     *
114     * @var string
115     */
116    private $startArrow;
117
118    /**
119     * End arrow type.
120     *
121     * @var string
122     */
123    private $endArrow;
124
125    /**
126     * Create a new instance.
127     *
128     * @param array $style
129     */
130    public function __construct($style = [])
131    {
132        $this->setStyleByArray($style);
133    }
134
135    /**
136     * Get unit.
137     *
138     * @return string
139     */
140    public function getUnit()
141    {
142        return $this->unit;
143    }
144
145    /**
146     * Get weight.
147     *
148     * @return float|int
149     */
150    public function getWeight()
151    {
152        return $this->weight;
153    }
154
155    /**
156     * Set weight.
157     *
158     * @param float|int $value
159     *
160     * @return self
161     */
162    public function setWeight($value = null)
163    {
164        $this->weight = $this->setNumericVal($value, null);
165
166        return $this;
167    }
168
169    /**
170     * Get color.
171     *
172     * @return string
173     */
174    public function getColor()
175    {
176        return $this->color;
177    }
178
179    /**
180     * Set color.
181     *
182     * @param string $value
183     *
184     * @return self
185     */
186    public function setColor($value = null)
187    {
188        $this->color = $value;
189
190        return $this;
191    }
192
193    /**
194     * Get dash type.
195     *
196     * @return string
197     */
198    public function getDash()
199    {
200        return $this->dash;
201    }
202
203    /**
204     * Set dash type.
205     *
206     * @param string $value
207     *
208     * @return self
209     */
210    public function setDash($value = null)
211    {
212        $this->dash = $value;
213
214        return $this;
215    }
216
217    /**
218     * Get line style.
219     *
220     * @return string
221     */
222    public function getLine()
223    {
224        return $this->line;
225    }
226
227    /**
228     * Set line style.
229     *
230     * @param string $value
231     *
232     * @return self
233     */
234    public function setLine($value = null)
235    {
236        $enum = [self::LINE_SINGLE, self::LINE_THIN_THIN, self::LINE_THIN_THICK,
237            self::LINE_THICK_THIN, self::LINE_THICK_BETWEEN_THIN, ];
238        $this->line = $this->setEnumVal($value, $enum, null);
239
240        return $this;
241    }
242
243    /**
244     * Get endCap style.
245     *
246     * @return string
247     */
248    public function getEndCap()
249    {
250        return $this->endCap;
251    }
252
253    /**
254     * Set endCap style.
255     *
256     * @param string $value
257     *
258     * @return self
259     */
260    public function setEndCap($value = null)
261    {
262        $enum = [self::ENDCAP_FLAT, self::ENDCAP_SQUARE, self::ENDCAP_ROUND];
263        $this->endCap = $this->setEnumVal($value, $enum, null);
264
265        return $this;
266    }
267
268    /**
269     * Get startArrow.
270     *
271     * @return string
272     */
273    public function getStartArrow()
274    {
275        return $this->startArrow;
276    }
277
278    /**
279     * Set pattern.
280     *
281     * @param string $value
282     *
283     * @return self
284     */
285    public function setStartArrow($value = null)
286    {
287        $enum = [self::ARROW_NONE, self::ARROW_BLOCK, self::ARROW_CLASSIC,
288            self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN, ];
289        $this->startArrow = $this->setEnumVal($value, $enum, null);
290
291        return $this;
292    }
293
294    /**
295     * Get endArrow.
296     *
297     * @return string
298     */
299    public function getEndArrow()
300    {
301        return $this->endArrow;
302    }
303
304    /**
305     * Set pattern.
306     *
307     * @param string $value
308     *
309     * @return self
310     */
311    public function setEndArrow($value = null)
312    {
313        $enum = [self::ARROW_NONE, self::ARROW_BLOCK, self::ARROW_CLASSIC,
314            self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN, ];
315        $this->endArrow = $this->setEnumVal($value, $enum, null);
316
317        return $this;
318    }
319}