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