Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
14 / 14 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
TextBox | |
100.00% |
14 / 14 |
|
100.00% |
2 / 2 |
5 | |
100.00% |
1 / 1 |
writeInnerMargin | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
3 | |||
writeBorder | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * This file is part of PHPWord - A pure PHP library for reading and writing |
4 | * word processing documents. |
5 | * PHPWord is free software distributed under the terms of the GNU Lesser |
6 | * General Public License version 3 as published by the Free Software Foundation. |
7 | * For the full copyright and license information, please read the LICENSE |
8 | * file that was distributed with this source code. For the full list of |
9 | * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. |
10 | * |
11 | * @see https://github.com/PHPOffice/PHPWord |
12 | * |
13 | * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 |
14 | */ |
15 | |
16 | namespace PhpOffice\PhpWord\Writer\Word2007\Style; |
17 | |
18 | use PhpOffice\PhpWord\Style\TextBox as TextBoxStyle; |
19 | |
20 | /** |
21 | * TextBox style writer. |
22 | * |
23 | * @since 0.11.0 |
24 | */ |
25 | class TextBox extends Frame |
26 | { |
27 | /** |
28 | * Writer inner margin. |
29 | */ |
30 | public function writeInnerMargin(): void |
31 | { |
32 | $style = $this->getStyle(); |
33 | if (!$style instanceof TextBoxStyle || !$style->hasInnerMargins()) { |
34 | return; |
35 | } |
36 | |
37 | $xmlWriter = $this->getXmlWriter(); |
38 | $margins = implode(', ', $style->getInnerMargin()); |
39 | |
40 | $xmlWriter->writeAttribute('inset', $margins); |
41 | } |
42 | |
43 | /** |
44 | * Writer border. |
45 | */ |
46 | public function writeBorder(): void |
47 | { |
48 | $style = $this->getStyle(); |
49 | if (!$style instanceof TextBoxStyle) { |
50 | return; |
51 | } |
52 | $xmlWriter = $this->getXmlWriter(); |
53 | |
54 | $xmlWriter->startElement('v:stroke'); |
55 | $xmlWriter->writeAttributeIf($style->getBorderSize() !== null, 'weight', $style->getBorderSize() . 'pt'); |
56 | $xmlWriter->writeAttributeIf($style->getBorderColor() !== null, 'color', $style->getBorderColor()); |
57 | $xmlWriter->endElement(); // v:stroke |
58 | } |
59 | } |