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/**
4 * This file is part of PHPWord - A pure PHP library for reading and writing
5 * word processing documents.
6 *
7 * PHPWord is free software distributed under the terms of the GNU Lesser
8 * General Public License version 3 as published by the Free Software Foundation.
9 *
10 * For the full copyright and license information, please read the LICENSE
11 * file that was distributed with this source code. For the full list of
12 * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
13 *
14 * @see         https://github.com/PHPOffice/PHPWord
15 *
16 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
17 */
18
19namespace PhpOffice\PhpWord\Element;
20
21use PhpOffice\PhpWord\Style\Shape as ShapeStyle;
22
23/**
24 * Shape element.
25 *
26 * @since 0.12.0
27 */
28class Shape extends AbstractElement
29{
30    /**
31     * Shape type arc|curve|line|polyline|rect|oval.
32     *
33     * @var string
34     */
35    private $type;
36
37    /**
38     * Shape style.
39     *
40     * @var ?ShapeStyle
41     */
42    private $style;
43
44    /**
45     * Create new instance.
46     *
47     * @param string $type
48     * @param mixed $style
49     */
50    public function __construct($type, $style = null)
51    {
52        $this->setType($type);
53        $this->style = $this->setNewStyle(new ShapeStyle(), $style);
54    }
55
56    /**
57     * Get type.
58     *
59     * @return string
60     */
61    public function getType()
62    {
63        return $this->type;
64    }
65
66    /**
67     * Set pattern.
68     *
69     * @param string $value
70     *
71     * @return self
72     */
73    public function setType($value = null)
74    {
75        $enum = ['arc', 'curve', 'line', 'polyline', 'rect', 'oval'];
76        $this->type = $this->setEnumVal($value, $enum, null);
77
78        return $this;
79    }
80
81    /**
82     * Get shape style.
83     *
84     * @return ?ShapeStyle
85     */
86    public function getStyle()
87    {
88        return $this->style;
89    }
90}