Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like PageSetup often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use PageSetup, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
105 | class PageSetup |
||
106 | { |
||
107 | /* Paper size */ |
||
108 | const PAPERSIZE_LETTER = 1; |
||
109 | const PAPERSIZE_LETTER_SMALL = 2; |
||
110 | const PAPERSIZE_TABLOID = 3; |
||
111 | const PAPERSIZE_LEDGER = 4; |
||
112 | const PAPERSIZE_LEGAL = 5; |
||
113 | const PAPERSIZE_STATEMENT = 6; |
||
114 | const PAPERSIZE_EXECUTIVE = 7; |
||
115 | const PAPERSIZE_A3 = 8; |
||
116 | const PAPERSIZE_A4 = 9; |
||
117 | const PAPERSIZE_A4_SMALL = 10; |
||
118 | const PAPERSIZE_A5 = 11; |
||
119 | const PAPERSIZE_B4 = 12; |
||
120 | const PAPERSIZE_B5 = 13; |
||
121 | const PAPERSIZE_FOLIO = 14; |
||
122 | const PAPERSIZE_QUARTO = 15; |
||
123 | const PAPERSIZE_STANDARD_1 = 16; |
||
124 | const PAPERSIZE_STANDARD_2 = 17; |
||
125 | const PAPERSIZE_NOTE = 18; |
||
126 | const PAPERSIZE_NO9_ENVELOPE = 19; |
||
127 | const PAPERSIZE_NO10_ENVELOPE = 20; |
||
128 | const PAPERSIZE_NO11_ENVELOPE = 21; |
||
129 | const PAPERSIZE_NO12_ENVELOPE = 22; |
||
130 | const PAPERSIZE_NO14_ENVELOPE = 23; |
||
131 | const PAPERSIZE_C = 24; |
||
132 | const PAPERSIZE_D = 25; |
||
133 | const PAPERSIZE_E = 26; |
||
134 | const PAPERSIZE_DL_ENVELOPE = 27; |
||
135 | const PAPERSIZE_C5_ENVELOPE = 28; |
||
136 | const PAPERSIZE_C3_ENVELOPE = 29; |
||
137 | const PAPERSIZE_C4_ENVELOPE = 30; |
||
138 | const PAPERSIZE_C6_ENVELOPE = 31; |
||
139 | const PAPERSIZE_C65_ENVELOPE = 32; |
||
140 | const PAPERSIZE_B4_ENVELOPE = 33; |
||
141 | const PAPERSIZE_B5_ENVELOPE = 34; |
||
142 | const PAPERSIZE_B6_ENVELOPE = 35; |
||
143 | const PAPERSIZE_ITALY_ENVELOPE = 36; |
||
144 | const PAPERSIZE_MONARCH_ENVELOPE = 37; |
||
145 | const PAPERSIZE_6_3_4_ENVELOPE = 38; |
||
146 | const PAPERSIZE_US_STANDARD_FANFOLD = 39; |
||
147 | const PAPERSIZE_GERMAN_STANDARD_FANFOLD = 40; |
||
148 | const PAPERSIZE_GERMAN_LEGAL_FANFOLD = 41; |
||
149 | const PAPERSIZE_ISO_B4 = 42; |
||
150 | const PAPERSIZE_JAPANESE_DOUBLE_POSTCARD = 43; |
||
151 | const PAPERSIZE_STANDARD_PAPER_1 = 44; |
||
152 | const PAPERSIZE_STANDARD_PAPER_2 = 45; |
||
153 | const PAPERSIZE_STANDARD_PAPER_3 = 46; |
||
154 | const PAPERSIZE_INVITE_ENVELOPE = 47; |
||
155 | const PAPERSIZE_LETTER_EXTRA_PAPER = 48; |
||
156 | const PAPERSIZE_LEGAL_EXTRA_PAPER = 49; |
||
157 | const PAPERSIZE_TABLOID_EXTRA_PAPER = 50; |
||
158 | const PAPERSIZE_A4_EXTRA_PAPER = 51; |
||
159 | const PAPERSIZE_LETTER_TRANSVERSE_PAPER = 52; |
||
160 | const PAPERSIZE_A4_TRANSVERSE_PAPER = 53; |
||
161 | const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER = 54; |
||
162 | const PAPERSIZE_SUPERA_SUPERA_A4_PAPER = 55; |
||
163 | const PAPERSIZE_SUPERB_SUPERB_A3_PAPER = 56; |
||
164 | const PAPERSIZE_LETTER_PLUS_PAPER = 57; |
||
165 | const PAPERSIZE_A4_PLUS_PAPER = 58; |
||
166 | const PAPERSIZE_A5_TRANSVERSE_PAPER = 59; |
||
167 | const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER = 60; |
||
168 | const PAPERSIZE_A3_EXTRA_PAPER = 61; |
||
169 | const PAPERSIZE_A5_EXTRA_PAPER = 62; |
||
170 | const PAPERSIZE_ISO_B5_EXTRA_PAPER = 63; |
||
171 | const PAPERSIZE_A2_PAPER = 64; |
||
172 | const PAPERSIZE_A3_TRANSVERSE_PAPER = 65; |
||
173 | const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER = 66; |
||
174 | |||
175 | /* Page orientation */ |
||
176 | const ORIENTATION_DEFAULT = 'default'; |
||
177 | const ORIENTATION_LANDSCAPE = 'landscape'; |
||
178 | const ORIENTATION_PORTRAIT = 'portrait'; |
||
179 | |||
180 | /* Print Range Set Method */ |
||
181 | const SETPRINTRANGE_OVERWRITE = 'O'; |
||
182 | const SETPRINTRANGE_INSERT = 'I'; |
||
183 | |||
184 | /** |
||
185 | * Paper size. |
||
186 | * |
||
187 | * @var int |
||
188 | */ |
||
189 | private $paperSize = self::PAPERSIZE_LETTER; |
||
190 | |||
191 | /** |
||
192 | * Orientation. |
||
193 | * |
||
194 | * @var string |
||
195 | */ |
||
196 | private $orientation = self::ORIENTATION_DEFAULT; |
||
197 | |||
198 | /** |
||
199 | * Scale (Print Scale). |
||
200 | * |
||
201 | * Print scaling. Valid values range from 10 to 400 |
||
202 | * This setting is overridden when fitToWidth and/or fitToHeight are in use |
||
203 | * |
||
204 | * @var int? |
||
205 | */ |
||
206 | private $scale = 100; |
||
207 | |||
208 | /** |
||
209 | * Fit To Page |
||
210 | * Whether scale or fitToWith / fitToHeight applies. |
||
211 | * |
||
212 | * @var bool |
||
213 | */ |
||
214 | private $fitToPage = false; |
||
215 | |||
216 | /** |
||
217 | * Fit To Height |
||
218 | * Number of vertical pages to fit on. |
||
219 | * |
||
220 | * @var int? |
||
221 | */ |
||
222 | private $fitToHeight = 1; |
||
223 | |||
224 | /** |
||
225 | * Fit To Width |
||
226 | * Number of horizontal pages to fit on. |
||
227 | * |
||
228 | * @var int? |
||
229 | */ |
||
230 | private $fitToWidth = 1; |
||
231 | |||
232 | /** |
||
233 | * Columns to repeat at left. |
||
234 | * |
||
235 | * @var array Containing start column and end column, empty array if option unset |
||
236 | */ |
||
237 | private $columnsToRepeatAtLeft = ['', '']; |
||
238 | |||
239 | /** |
||
240 | * Rows to repeat at top. |
||
241 | * |
||
242 | * @var array Containing start row number and end row number, empty array if option unset |
||
243 | */ |
||
244 | private $rowsToRepeatAtTop = [0, 0]; |
||
245 | |||
246 | /** |
||
247 | * Center page horizontally. |
||
248 | * |
||
249 | * @var bool |
||
250 | */ |
||
251 | private $horizontalCentered = false; |
||
252 | |||
253 | /** |
||
254 | * Center page vertically. |
||
255 | * |
||
256 | * @var bool |
||
257 | */ |
||
258 | private $verticalCentered = false; |
||
259 | |||
260 | /** |
||
261 | * Print area. |
||
262 | * |
||
263 | * @var string |
||
264 | */ |
||
265 | private $printArea = null; |
||
266 | |||
267 | /** |
||
268 | * First page number. |
||
269 | * |
||
270 | * @var int |
||
271 | */ |
||
272 | private $firstPageNumber = null; |
||
273 | |||
274 | /** |
||
275 | * Create a new PageSetup. |
||
276 | */ |
||
277 | 105 | public function __construct() |
|
278 | { |
||
279 | 105 | } |
|
280 | |||
281 | /** |
||
282 | * Get Paper Size. |
||
283 | * |
||
284 | * @return int |
||
285 | */ |
||
286 | 61 | public function getPaperSize() |
|
287 | { |
||
288 | 61 | return $this->paperSize; |
|
289 | } |
||
290 | |||
291 | /** |
||
292 | * Set Paper Size. |
||
293 | * |
||
294 | * @param int $pValue see self::PAPERSIZE_* |
||
295 | * |
||
296 | * @return PageSetup |
||
297 | */ |
||
298 | 23 | public function setPaperSize($pValue) |
|
299 | { |
||
300 | 23 | $this->paperSize = $pValue; |
|
301 | |||
302 | 23 | return $this; |
|
303 | } |
||
304 | |||
305 | /** |
||
306 | * Get Orientation. |
||
307 | * |
||
308 | * @return string |
||
309 | */ |
||
310 | 61 | public function getOrientation() |
|
311 | { |
||
312 | 61 | return $this->orientation; |
|
313 | } |
||
314 | |||
315 | /** |
||
316 | * Set Orientation. |
||
317 | * |
||
318 | * @param string $pValue see self::ORIENTATION_* |
||
319 | * |
||
320 | * @return PageSetup |
||
321 | */ |
||
322 | 23 | public function setOrientation($pValue) |
|
323 | { |
||
324 | 23 | $this->orientation = $pValue; |
|
325 | |||
326 | 23 | return $this; |
|
327 | } |
||
328 | |||
329 | /** |
||
330 | * Get Scale. |
||
331 | * |
||
332 | * @return int? |
||
|
|||
333 | */ |
||
334 | 58 | public function getScale() |
|
335 | { |
||
336 | 58 | return $this->scale; |
|
337 | } |
||
338 | |||
339 | /** |
||
340 | * Set Scale. |
||
341 | * Print scaling. Valid values range from 10 to 400 |
||
342 | * This setting is overridden when fitToWidth and/or fitToHeight are in use. |
||
343 | * |
||
344 | * @param int|null $pValue |
||
345 | * @param bool $pUpdate Update fitToPage so scaling applies rather than fitToHeight / fitToWidth |
||
346 | * |
||
347 | * @throws PhpSpreadsheetException |
||
348 | * |
||
349 | * @return PageSetup |
||
350 | */ |
||
351 | 9 | public function setScale($pValue, $pUpdate = true) |
|
352 | { |
||
353 | // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, |
||
354 | // but it is apparently still able to handle any scale >= 0, where 0 results in 100 |
||
355 | 9 | if (($pValue >= 0) || is_null($pValue)) { |
|
356 | 9 | $this->scale = $pValue; |
|
357 | 9 | if ($pUpdate) { |
|
358 | 9 | $this->fitToPage = false; |
|
359 | } |
||
360 | } else { |
||
361 | throw new PhpSpreadsheetException('Scale must not be negative'); |
||
362 | } |
||
363 | |||
364 | 9 | return $this; |
|
365 | } |
||
366 | |||
367 | /** |
||
368 | * Get Fit To Page. |
||
369 | * |
||
370 | * @return bool |
||
371 | */ |
||
372 | 58 | public function getFitToPage() |
|
373 | { |
||
374 | 58 | return $this->fitToPage; |
|
375 | } |
||
376 | |||
377 | /** |
||
378 | * Set Fit To Page. |
||
379 | * |
||
380 | * @param bool $pValue |
||
381 | * |
||
382 | * @return PageSetup |
||
383 | */ |
||
384 | 4 | public function setFitToPage($pValue) |
|
385 | { |
||
386 | 4 | $this->fitToPage = $pValue; |
|
387 | |||
388 | 4 | return $this; |
|
389 | } |
||
390 | |||
391 | /** |
||
392 | * Get Fit To Height. |
||
393 | * |
||
394 | * @return int? |
||
395 | */ |
||
396 | 58 | public function getFitToHeight() |
|
397 | { |
||
398 | 58 | return $this->fitToHeight; |
|
399 | } |
||
400 | |||
401 | /** |
||
402 | * Set Fit To Height. |
||
403 | * |
||
404 | * @param int|null $pValue |
||
405 | * @param bool $pUpdate Update fitToPage so it applies rather than scaling |
||
406 | * |
||
407 | * @return PageSetup |
||
408 | */ |
||
409 | 9 | public function setFitToHeight($pValue, $pUpdate = true) |
|
410 | { |
||
411 | 9 | $this->fitToHeight = $pValue; |
|
412 | 9 | if ($pUpdate) { |
|
413 | $this->fitToPage = true; |
||
414 | } |
||
415 | |||
416 | 9 | return $this; |
|
417 | } |
||
418 | |||
419 | /** |
||
420 | * Get Fit To Width. |
||
421 | * |
||
422 | * @return int? |
||
423 | */ |
||
424 | 58 | public function getFitToWidth() |
|
425 | { |
||
426 | 58 | return $this->fitToWidth; |
|
427 | } |
||
428 | |||
429 | /** |
||
430 | * Set Fit To Width. |
||
431 | * |
||
432 | * @param int|null $pValue |
||
433 | * @param bool $pUpdate Update fitToPage so it applies rather than scaling |
||
434 | * |
||
435 | * @return PageSetup |
||
436 | */ |
||
437 | 9 | public function setFitToWidth($pValue, $pUpdate = true) |
|
438 | { |
||
439 | 9 | $this->fitToWidth = $pValue; |
|
440 | 9 | if ($pUpdate) { |
|
441 | $this->fitToPage = true; |
||
442 | } |
||
443 | |||
444 | 9 | return $this; |
|
445 | } |
||
446 | |||
447 | /** |
||
448 | * Is Columns to repeat at left set? |
||
449 | * |
||
450 | * @return bool |
||
451 | */ |
||
452 | 58 | public function isColumnsToRepeatAtLeftSet() |
|
453 | { |
||
454 | 58 | if (is_array($this->columnsToRepeatAtLeft)) { |
|
455 | 58 | if ($this->columnsToRepeatAtLeft[0] != '' && $this->columnsToRepeatAtLeft[1] != '') { |
|
456 | return true; |
||
457 | } |
||
458 | } |
||
459 | |||
460 | 58 | return false; |
|
461 | } |
||
462 | |||
463 | /** |
||
464 | * Get Columns to repeat at left. |
||
465 | * |
||
466 | * @return array Containing start column and end column, empty array if option unset |
||
467 | */ |
||
468 | public function getColumnsToRepeatAtLeft() |
||
472 | |||
473 | /** |
||
474 | * Set Columns to repeat at left. |
||
475 | * |
||
476 | * @param array $pValue Containing start column and end column, empty array if option unset |
||
477 | * |
||
478 | * @return PageSetup |
||
479 | */ |
||
480 | public function setColumnsToRepeatAtLeft(array $pValue) |
||
481 | { |
||
482 | $this->columnsToRepeatAtLeft = $pValue; |
||
483 | |||
484 | return $this; |
||
485 | } |
||
486 | |||
487 | /** |
||
488 | * Set Columns to repeat at left by start and end. |
||
489 | * |
||
490 | * @param string $pStart eg: 'A' |
||
491 | * @param string $pEnd eg: 'B' |
||
492 | * |
||
493 | * @return PageSetup |
||
494 | */ |
||
495 | public function setColumnsToRepeatAtLeftByStartAndEnd($pStart, $pEnd) |
||
501 | |||
502 | /** |
||
503 | * Is Rows to repeat at top set? |
||
504 | * |
||
505 | * @return bool |
||
506 | */ |
||
507 | 62 | public function isRowsToRepeatAtTopSet() |
|
517 | |||
518 | /** |
||
519 | * Get Rows to repeat at top. |
||
520 | * |
||
521 | * @return array Containing start column and end column, empty array if option unset |
||
522 | */ |
||
523 | 1 | public function getRowsToRepeatAtTop() |
|
527 | |||
528 | /** |
||
529 | * Set Rows to repeat at top. |
||
530 | * |
||
531 | * @param array $pValue Containing start column and end column, empty array if option unset |
||
532 | * |
||
533 | * @return PageSetup |
||
534 | */ |
||
535 | 1 | public function setRowsToRepeatAtTop(array $pValue) |
|
536 | { |
||
541 | |||
542 | /** |
||
543 | * Set Rows to repeat at top by start and end. |
||
544 | * |
||
545 | * @param int $pStart eg: 1 |
||
546 | * @param int $pEnd eg: 1 |
||
547 | * |
||
548 | * @return PageSetup |
||
549 | */ |
||
550 | 1 | public function setRowsToRepeatAtTopByStartAndEnd($pStart, $pEnd) |
|
556 | |||
557 | /** |
||
558 | * Get center page horizontally. |
||
559 | * |
||
560 | * @return bool |
||
561 | */ |
||
562 | 58 | public function getHorizontalCentered() |
|
566 | |||
567 | /** |
||
568 | * Set center page horizontally. |
||
569 | * |
||
570 | * @param bool $value |
||
571 | * |
||
572 | * @return PageSetup |
||
573 | */ |
||
574 | 4 | public function setHorizontalCentered($value) |
|
580 | |||
581 | /** |
||
582 | * Get center page vertically. |
||
583 | * |
||
584 | * @return bool |
||
585 | */ |
||
586 | 58 | public function getVerticalCentered() |
|
590 | |||
591 | /** |
||
592 | * Set center page vertically. |
||
593 | * |
||
594 | * @param bool $value |
||
595 | * |
||
596 | * @return PageSetup |
||
597 | */ |
||
598 | 4 | public function setVerticalCentered($value) |
|
604 | |||
605 | /** |
||
606 | * Get print area. |
||
607 | * |
||
608 | * @param int $index Identifier for a specific print area range if several ranges have been set |
||
609 | * Default behaviour, or a index value of 0, will return all ranges as a comma-separated string |
||
610 | * Otherwise, the specific range identified by the value of $index will be returned |
||
611 | * Print areas are numbered from 1 |
||
612 | * |
||
613 | * @throws PhpSpreadsheetException |
||
614 | * |
||
615 | * @return string |
||
616 | */ |
||
617 | public function getPrintArea($index = 0) |
||
628 | |||
629 | /** |
||
630 | * Is print area set? |
||
631 | * |
||
632 | * @param int $index Identifier for a specific print area range if several ranges have been set |
||
633 | * Default behaviour, or an index value of 0, will identify whether any print range is set |
||
634 | * Otherwise, existence of the range identified by the value of $index will be returned |
||
635 | * Print areas are numbered from 1 |
||
636 | * |
||
637 | * @return bool |
||
638 | */ |
||
639 | 62 | public function isPrintAreaSet($index = 0) |
|
648 | |||
649 | /** |
||
650 | * Clear a print area. |
||
651 | * |
||
652 | * @param int $index Identifier for a specific print area range if several ranges have been set |
||
653 | * Default behaviour, or an index value of 0, will clear all print ranges that are set |
||
654 | * Otherwise, the range identified by the value of $index will be removed from the series |
||
655 | * Print areas are numbered from 1 |
||
656 | * |
||
657 | * @return PageSetup |
||
658 | */ |
||
659 | public function clearPrintArea($index = 0) |
||
673 | |||
674 | /** |
||
675 | * Set print area. e.g. 'A1:D10' or 'A1:D10,G5:M20'. |
||
676 | * |
||
677 | * @param string $value |
||
678 | * @param int $index Identifier for a specific print area range allowing several ranges to be set |
||
679 | * When the method is "O"verwrite, then a positive integer index will overwrite that indexed |
||
680 | * entry in the print areas list; a negative index value will identify which entry to |
||
681 | * overwrite working bacward through the print area to the list, with the last entry as -1. |
||
682 | * Specifying an index value of 0, will overwrite <b>all</b> existing print ranges. |
||
683 | * When the method is "I"nsert, then a positive index will insert after that indexed entry in |
||
684 | * the print areas list, while a negative index will insert before the indexed entry. |
||
685 | * Specifying an index value of 0, will always append the new print range at the end of the |
||
686 | * list. |
||
687 | * Print areas are numbered from 1 |
||
688 | * @param string $method Determines the method used when setting multiple print areas |
||
689 | * Default behaviour, or the "O" method, overwrites existing print area |
||
690 | * The "I" method, inserts the new print area before any specified index, or at the end of the list |
||
691 | * |
||
692 | * @throws PhpSpreadsheetException |
||
693 | * |
||
694 | * @return PageSetup |
||
695 | */ |
||
696 | public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) |
||
741 | |||
742 | /** |
||
743 | * Add a new print area (e.g. 'A1:D10' or 'A1:D10,G5:M20') to the list of print areas. |
||
744 | * |
||
745 | * @param string $value |
||
746 | * @param int $index Identifier for a specific print area range allowing several ranges to be set |
||
747 | * A positive index will insert after that indexed entry in the print areas list, while a |
||
748 | * negative index will insert before the indexed entry. |
||
749 | * Specifying an index value of 0, will always append the new print range at the end of the |
||
750 | * list. |
||
751 | * Print areas are numbered from 1 |
||
752 | * |
||
753 | * @throws PhpSpreadsheetException |
||
754 | * |
||
755 | * @return PageSetup |
||
756 | */ |
||
757 | public function addPrintArea($value, $index = -1) |
||
761 | |||
762 | /** |
||
763 | * Set print area. |
||
764 | * |
||
765 | * @param int $column1 Column 1 |
||
766 | * @param int $row1 Row 1 |
||
767 | * @param int $column2 Column 2 |
||
768 | * @param int $row2 Row 2 |
||
769 | * @param int $index Identifier for a specific print area range allowing several ranges to be set |
||
770 | * When the method is "O"verwrite, then a positive integer index will overwrite that indexed |
||
771 | * entry in the print areas list; a negative index value will identify which entry to |
||
772 | * overwrite working bacward through the print area to the list, with the last entry as -1. |
||
773 | * Specifying an index value of 0, will overwrite <b>all</b> existing print ranges. |
||
774 | * When the method is "I"nsert, then a positive index will insert after that indexed entry in |
||
775 | * the print areas list, while a negative index will insert before the indexed entry. |
||
776 | * Specifying an index value of 0, will always append the new print range at the end of the |
||
777 | * list. |
||
778 | * Print areas are numbered from 1 |
||
779 | * @param string $method Determines the method used when setting multiple print areas |
||
780 | * Default behaviour, or the "O" method, overwrites existing print area |
||
781 | * The "I" method, inserts the new print area before any specified index, or at the end of the list |
||
782 | * |
||
783 | * @throws PhpSpreadsheetException |
||
784 | * |
||
785 | * @return PageSetup |
||
786 | */ |
||
787 | View Code Duplication | public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) |
|
788 | { |
||
789 | return $this->setPrintArea( |
||
790 | Cell::stringFromColumnIndex($column1) . $row1 . ':' . Cell::stringFromColumnIndex($column2) . $row2, |
||
791 | $index, |
||
792 | $method |
||
793 | ); |
||
794 | } |
||
795 | |||
796 | /** |
||
797 | * Add a new print area to the list of print areas. |
||
798 | * |
||
799 | * @param int $column1 Start Column for the print area |
||
800 | * @param int $row1 Start Row for the print area |
||
801 | * @param int $column2 End Column for the print area |
||
802 | * @param int $row2 End Row for the print area |
||
803 | * @param int $index Identifier for a specific print area range allowing several ranges to be set |
||
804 | * A positive index will insert after that indexed entry in the print areas list, while a |
||
805 | * negative index will insert before the indexed entry. |
||
806 | * Specifying an index value of 0, will always append the new print range at the end of the |
||
807 | * list. |
||
808 | * Print areas are numbered from 1 |
||
809 | * |
||
810 | * @throws PhpSpreadsheetException |
||
811 | * |
||
812 | * @return PageSetup |
||
813 | */ |
||
814 | View Code Duplication | public function addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = -1) |
|
815 | { |
||
816 | return $this->setPrintArea( |
||
817 | Cell::stringFromColumnIndex($column1) . $row1 . ':' . Cell::stringFromColumnIndex($column2) . $row2, |
||
818 | $index, |
||
819 | self::SETPRINTRANGE_INSERT |
||
820 | ); |
||
821 | } |
||
822 | |||
823 | /** |
||
824 | * Get first page number. |
||
825 | * |
||
826 | * @return int |
||
827 | */ |
||
828 | 56 | public function getFirstPageNumber() |
|
832 | |||
833 | /** |
||
834 | * Set first page number. |
||
835 | * |
||
836 | * @param int $value |
||
837 | * |
||
838 | * @return PageSetup |
||
839 | */ |
||
840 | public function setFirstPageNumber($value) |
||
846 | |||
847 | /** |
||
848 | * Reset first page number. |
||
849 | * |
||
850 | * @return PageSetup |
||
851 | */ |
||
852 | public function resetFirstPageNumber() |
||
856 | |||
857 | /** |
||
858 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
||
859 | */ |
||
860 | View Code Duplication | public function __clone() |
|
871 | } |
||
872 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.