Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
Shape
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setType
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getStyle
100.00% covered (success)
100.00%
1 / 1
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\Element;
19
20use PhpOffice\PhpWord\Style\Shape as ShapeStyle;
21
22/**
23 * Shape element.
24 *
25 * @since 0.12.0
26 */
27class Shape extends AbstractElement
28{
29    /**
30     * Shape type arc|curve|line|polyline|rect|oval.
31     *
32     * @var string
33     */
34    private $type;
35
36    /**
37     * Shape style.
38     *
39     * @var ?\PhpOffice\PhpWord\Style\Shape
40     */
41    private $style;
42
43    /**
44     * Create new instance.
45     *
46     * @param string $type
47     * @param mixed $style
48     */
49    public function __construct($type, $style = null)
50    {
51        $this->setType($type);
52        $this->style = $this->setNewStyle(new ShapeStyle(), $style);
53    }
54
55    /**
56     * Get type.
57     *
58     * @return string
59     */
60    public function getType()
61    {
62        return $this->type;
63    }
64
65    /**
66     * Set pattern.
67     *
68     * @param string $value
69     *
70     * @return self
71     */
72    public function setType($value = null)
73    {
74        $enum = ['arc', 'curve', 'line', 'polyline', 'rect', 'oval'];
75        $this->type = $this->setEnumVal($value, $enum, null);
76
77        return $this;
78    }
79
80    /**
81     * Get shape style.
82     *
83     * @return ?\PhpOffice\PhpWord\Style\Shape
84     */
85    public function getStyle()
86    {
87        return $this->style;
88    }
89}