Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
31 / 31
100.00% covered (success)
100.00%
17 / 17
CRAP
100.00% covered (success)
100.00%
1 / 1
Image
100.00% covered (success)
100.00%
31 / 31
100.00% covered (success)
100.00%
17 / 17
17
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
 getMarginTop
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setMarginTop
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getMarginLeft
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setMarginLeft
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getWrappingStyle
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setWrappingStyle
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getPositioning
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setPositioning
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getPosHorizontal
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setPosHorizontal
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getPosVertical
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setPosVertical
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getPosHorizontalRel
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setPosHorizontalRel
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getPosVerticalRel
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setPosVerticalRel
100.00% covered (success)
100.00%
2 / 2
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 * Image and memory image style.
22 */
23class Image extends Frame
24{
25    /**
26     * Backward compatibility constants.
27     *
28     * @const string
29     */
30    const WRAPPING_STYLE_INLINE = self::WRAP_INLINE;
31    const WRAPPING_STYLE_SQUARE = self::WRAP_SQUARE;
32    const WRAPPING_STYLE_TIGHT = self::WRAP_TIGHT;
33    const WRAPPING_STYLE_BEHIND = self::WRAP_BEHIND;
34    const WRAPPING_STYLE_INFRONT = self::WRAP_INFRONT;
35    const POSITION_HORIZONTAL_LEFT = self::POS_LEFT;
36    const POSITION_HORIZONTAL_CENTER = self::POS_CENTER;
37    const POSITION_HORIZONTAL_RIGHT = self::POS_RIGHT;
38    const POSITION_VERTICAL_TOP = self::POS_TOP;
39    const POSITION_VERTICAL_CENTER = self::POS_CENTER;
40    const POSITION_VERTICAL_BOTTOM = self::POS_BOTTOM;
41    const POSITION_VERTICAL_INSIDE = self::POS_INSIDE;
42    const POSITION_VERTICAL_OUTSIDE = self::POS_OUTSIDE;
43    const POSITION_RELATIVE_TO_MARGIN = self::POS_RELTO_MARGIN;
44    const POSITION_RELATIVE_TO_PAGE = self::POS_RELTO_PAGE;
45    const POSITION_RELATIVE_TO_COLUMN = self::POS_RELTO_COLUMN;
46    const POSITION_RELATIVE_TO_CHAR = self::POS_RELTO_CHAR;
47    const POSITION_RELATIVE_TO_TEXT = self::POS_RELTO_TEXT;
48    const POSITION_RELATIVE_TO_LINE = self::POS_RELTO_LINE;
49    const POSITION_RELATIVE_TO_LMARGIN = self::POS_RELTO_LMARGIN;
50    const POSITION_RELATIVE_TO_RMARGIN = self::POS_RELTO_RMARGIN;
51    const POSITION_RELATIVE_TO_TMARGIN = self::POS_RELTO_TMARGIN;
52    const POSITION_RELATIVE_TO_BMARGIN = self::POS_RELTO_BMARGIN;
53    const POSITION_RELATIVE_TO_IMARGIN = self::POS_RELTO_IMARGIN;
54    const POSITION_RELATIVE_TO_OMARGIN = self::POS_RELTO_OMARGIN;
55    const POSITION_ABSOLUTE = self::POS_ABSOLUTE;
56    const POSITION_RELATIVE = self::POS_RELATIVE;
57
58    /**
59     * Create new instance.
60     */
61    public function __construct()
62    {
63        parent::__construct();
64        $this->setUnit(self::UNIT_PT);
65
66        // Backward compatibility setting
67        // @todo Remove on 1.0.0
68        $this->setWrap(self::WRAPPING_STYLE_INLINE);
69        $this->setHPos(self::POSITION_HORIZONTAL_LEFT);
70        $this->setHPosRelTo(self::POSITION_RELATIVE_TO_CHAR);
71        $this->setVPos(self::POSITION_VERTICAL_TOP);
72        $this->setVPosRelTo(self::POSITION_RELATIVE_TO_LINE);
73    }
74
75    /**
76     * Get margin top.
77     *
78     * @return float|int
79     */
80    public function getMarginTop()
81    {
82        return $this->getTop();
83    }
84
85    /**
86     * Set margin top.
87     *
88     * @ignoreScrutinizerPatch
89     *
90     * @param float|int $value
91     *
92     * @return self
93     */
94    public function setMarginTop($value = 0)
95    {
96        $this->setTop($value);
97
98        return $this;
99    }
100
101    /**
102     * Get margin left.
103     *
104     * @return float|int
105     */
106    public function getMarginLeft()
107    {
108        return $this->getLeft();
109    }
110
111    /**
112     * Set margin left.
113     *
114     * @ignoreScrutinizerPatch
115     *
116     * @param float|int $value
117     *
118     * @return self
119     */
120    public function setMarginLeft($value = 0)
121    {
122        $this->setLeft($value);
123
124        return $this;
125    }
126
127    /**
128     * Get wrapping style.
129     *
130     * @return string
131     */
132    public function getWrappingStyle()
133    {
134        return $this->getWrap();
135    }
136
137    /**
138     * Set wrapping style.
139     *
140     * @param string $wrappingStyle
141     *
142     * @return self
143     */
144    public function setWrappingStyle($wrappingStyle)
145    {
146        $this->setWrap($wrappingStyle);
147
148        return $this;
149    }
150
151    /**
152     * Get positioning type.
153     *
154     * @return string
155     */
156    public function getPositioning()
157    {
158        return $this->getPos();
159    }
160
161    /**
162     * Set positioning type.
163     *
164     * @param string $positioning
165     *
166     * @return self
167     */
168    public function setPositioning($positioning)
169    {
170        $this->setPos($positioning);
171
172        return $this;
173    }
174
175    /**
176     * Get horizontal alignment.
177     *
178     * @return string
179     */
180    public function getPosHorizontal()
181    {
182        return $this->getHPos();
183    }
184
185    /**
186     * Set horizontal alignment.
187     *
188     * @param string $alignment
189     *
190     * @return self
191     */
192    public function setPosHorizontal($alignment)
193    {
194        $this->setHPos($alignment);
195
196        return $this;
197    }
198
199    /**
200     * Get vertical alignment.
201     *
202     * @return string
203     */
204    public function getPosVertical()
205    {
206        return $this->getVPos();
207    }
208
209    /**
210     * Set vertical alignment.
211     *
212     * @param string $alignment
213     *
214     * @return self
215     */
216    public function setPosVertical($alignment)
217    {
218        $this->setVPos($alignment);
219
220        return $this;
221    }
222
223    /**
224     * Get horizontal relation.
225     *
226     * @return string
227     */
228    public function getPosHorizontalRel()
229    {
230        return $this->getHPosRelTo();
231    }
232
233    /**
234     * Set horizontal relation.
235     *
236     * @param string $relto
237     *
238     * @return self
239     */
240    public function setPosHorizontalRel($relto)
241    {
242        $this->setHPosRelTo($relto);
243
244        return $this;
245    }
246
247    /**
248     * Get vertical relation.
249     *
250     * @return string
251     */
252    public function getPosVerticalRel()
253    {
254        return $this->getVPosRelTo();
255    }
256
257    /**
258     * Set vertical relation.
259     *
260     * @param string $relto
261     *
262     * @return self
263     */
264    public function setPosVerticalRel($relto)
265    {
266        $this->setVPosRelTo($relto);
267
268        return $this;
269    }
270}