Complex classes like DefaultPrinter 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 DefaultPrinter, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
35 | abstract class DefaultPrinter implements PrinterInterface |
||
36 | { |
||
37 | //set standards |
||
38 | const NUL = "\x0"; //Nulo |
||
39 | const EOT = "\x4"; //EOT fim da transmissão |
||
40 | const ENQ = "\x5"; //ENQ colocar na fila Pedido de status 1 |
||
41 | const HT = "\x9"; //tabulação horizontal |
||
42 | const VT = "\xb"; //tabulação vertical |
||
43 | const LF = "\x0a"; //Inicia a impressão e avança uma linha |
||
44 | const FF = "\x0c"; //avança pagina |
||
45 | const CR = "\x0d"; //retorno de carro |
||
46 | const DLE = "\x10"; //Data Link Escape |
||
47 | const CAN = "\x18"; //CAN Cancela linha enviada |
||
48 | const BEL = "\x07"; //BEL sinal sonoro |
||
49 | const ESC = "\x1b"; //escape |
||
50 | const FS = "\x1c"; //FS |
||
51 | const GS = "\x1d"; //GS |
||
52 | const SO = "\x0e"; //SO Inicia modo expandido |
||
53 | const DC1 = "\x11"; //DC1 Inicia modo enfatizado |
||
54 | const DC2 = "\x12"; //DC2 Cancela modo condensado |
||
55 | const DC3 = "\x13"; //DC3 Cancela modo enfatizado |
||
56 | const DC4 = "\x14"; //DC4 Controle de dispositivo 4 Inicia modo normal |
||
57 | const SI = "\x0f"; //Seleciona modo condensado |
||
58 | const EM = "\x19"; //Avança 4 linhas |
||
59 | const DEL = "\x7f"; //Cancela último caracter |
||
60 | const NAK = "\x15"; // |
||
61 | const SYN = "\x16"; //Sincronismo |
||
62 | const NOTRANS = false; //not translate characters codepage |
||
63 | const TRANS = true; //perform a character convertion to codepage |
||
64 | |||
65 | //Cut types |
||
66 | const CUT_FULL = 65; |
||
67 | const CUT_PARTIAL = 66; |
||
68 | |||
69 | //Image sizing options |
||
70 | const IMG_DEFAULT = 0; |
||
71 | const IMG_DOUBLE_WIDTH = 1; |
||
72 | const IMG_DOUBLE_HEIGHT = 2; |
||
73 | |||
74 | /** |
||
75 | * List all available region pages. |
||
76 | * |
||
77 | * @var array |
||
78 | */ |
||
79 | protected $aRegion = array( |
||
80 | 'USA', |
||
81 | 'FRANCE', |
||
82 | 'GERMANY', |
||
83 | 'UK', |
||
84 | 'DENMARK', |
||
85 | 'SWEDEN', |
||
86 | 'ITALY', |
||
87 | 'SPAIN', |
||
88 | 'JAPAN', |
||
89 | 'NORWAY', |
||
90 | 'DENMARK2', |
||
91 | 'SPAIN2', |
||
92 | 'LATIN', |
||
93 | 'KOREA', |
||
94 | 'SLOVENIA', |
||
95 | 'CHINA', |
||
96 | 'VIETNAM', |
||
97 | 'ARABIA' |
||
98 | ); |
||
99 | |||
100 | /** |
||
101 | * List all available code pages. |
||
102 | * |
||
103 | * @var array |
||
104 | */ |
||
105 | protected $aCodePage = array( |
||
106 | 'CP437' => array('conv' => '437', 'table' => '0', 'desc' => 'PC437: USA, Standard Europe'), |
||
107 | 'CP850' => array('conv' => '850', 'table' => '2', 'desc' => 'PC850: Multilingual'), |
||
108 | 'CP860' => array('conv' => '860', 'table' => '3', 'desc' => 'PC860: Portuguese'), |
||
109 | 'CP863' => array('conv' => '863', 'table' => '4', 'desc' => 'PC863: Canadian-French'), |
||
110 | 'CP865' => array('conv' => '865', 'table' => '5', 'desc' => 'PC865: Nordic'), |
||
111 | 'CP851' => array('conv' => '851', 'table' => '11', 'desc' => 'PC851: Greek'), |
||
112 | 'CP853' => array('conv' => '853', 'table' => '12', 'desc' => 'PC853: Turkish'), |
||
113 | 'CP857' => array('conv' => '857', 'table' => '13', 'desc' => 'PC857: Turkish'), |
||
114 | 'CP737' => array('conv' => '737', 'table' => '14', 'desc' => 'PC737: Greek'), |
||
115 | 'ISO8859-7' => array('conv' => 'ISO8859-7', 'table' => '15', 'desc' => 'ISO8859-7: Greek'), |
||
116 | 'CP866' => array('conv' => '866', 'table' => '17', 'desc' => 'PC866: Cyrillic #2'), |
||
117 | 'CP852' => array('conv' => '852', 'table' => '18', 'desc' => 'PC852: Latin2'), |
||
118 | 'CP858' => array('conv' => '858', 'table' => '19', 'desc' => 'PC858: Euro'), |
||
119 | 'CP720' => array('conv' => '720', 'table' => '32', 'desc' => 'PC720: Arabic'), |
||
120 | 'CP855' => array('conv' => '855', 'table' => '34', 'desc' => 'PC855: Cyrillic'), |
||
121 | 'CP861' => array('conv' => '861', 'table' => '35', 'desc' => 'PC861: Icelandic'), |
||
122 | 'CP862' => array('conv' => '862', 'table' => '36', 'desc' => 'PC862: Hebrew'), |
||
123 | 'CP864' => array('conv' => '864', 'table' => '37', 'desc' => 'PC864: Arabic'), |
||
124 | 'CP869' => array('conv' => '869', 'table' => '38', 'desc' => 'PC869: Greek'), |
||
125 | 'ISO8859-2' => array('conv' => 'ISO8859-2', 'table' => '39', 'desc' => 'ISO8859-2: Latin2'), |
||
126 | 'ISO8859-15' => array('conv' => 'ISO8859-15', 'table' => '40', 'desc' => 'ISO8859-15: Latin9'), |
||
127 | 'WINDOWS-1250' => array('conv' => 'WINDOWS-1250', 'table' => '45', 'desc' => 'WPC1250: Latin2'), |
||
128 | 'WINDOWS-1251' => array('conv' => 'WINDOWS-1251', 'table' => '46', 'desc' => 'WPC1251: Cyrillic'), |
||
129 | 'WINDOWS-1252' => array('conv' => 'WINDOWS-1252', 'table' => '47', 'desc' => 'WPC1253: Greek'), |
||
130 | 'WINDOWS-1254' => array('conv' => 'WINDOWS-1254', 'table' => '48', 'desc' => 'WPC1254: Turkish'), |
||
131 | 'WINDOWS-1255' => array('conv' => 'WINDOWS-1255', 'table' => '49', 'desc' => 'WPC1255: Hebrew'), |
||
132 | 'WINDOWS-1256' => array('conv' => 'WINDOWS-1256', 'table' => '50', 'desc' => 'WPC1256: Arabic'), |
||
133 | 'WINDOWS-1257' => array('conv' => 'WINDOWS-1257', 'table' => '51', 'desc' => 'WPC1257: Baltic Rim'), |
||
134 | 'WINDOWS-1258' => array('conv' => 'WINDOWS-1258', 'table' => '52', 'desc' => 'WPC1258: Vietnamese'), |
||
135 | ); |
||
136 | |||
137 | /** |
||
138 | * Seleted code page |
||
139 | * Defined in printer class. |
||
140 | * |
||
141 | * @var string |
||
142 | */ |
||
143 | protected $codepage = 'CP437'; |
||
144 | /** |
||
145 | * Number of codpage in printer memory. |
||
146 | * |
||
147 | * @var int |
||
148 | */ |
||
149 | protected $charsetTableNum = 0; |
||
150 | /** |
||
151 | * Selected Region character page |
||
152 | * Defined in printer class. |
||
153 | * |
||
154 | * @var string |
||
155 | */ |
||
156 | protected $region = 'LATIN'; |
||
157 | /** |
||
158 | * List all avaiable fonts |
||
159 | * |
||
160 | * @var array |
||
161 | */ |
||
162 | protected $aFont = array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D', 4 => 'E', 97 => 'SA', 98 => 'SB'); |
||
163 | /** |
||
164 | * Selected internal font. |
||
165 | * |
||
166 | * @var string |
||
167 | */ |
||
168 | protected $font = 'A'; |
||
169 | /** |
||
170 | * Resolution in dpi. |
||
171 | * |
||
172 | * @var int |
||
173 | */ |
||
174 | public $dpi = 203; //dots per inch |
||
175 | /** |
||
176 | * Resolution in dpmm. |
||
177 | * |
||
178 | * @var int |
||
179 | */ |
||
180 | public $dpmm = 8; //dots per mm |
||
181 | /** |
||
182 | * Maximum width paper. |
||
183 | * |
||
184 | * @var int |
||
185 | */ |
||
186 | public $widthMaxmm = 80;//mm |
||
187 | /** |
||
188 | * Selected Width paper. |
||
189 | * |
||
190 | * @var int |
||
191 | */ |
||
192 | public $widthPaper = 80;//mm |
||
193 | /** |
||
194 | * Maximum width for printed area. |
||
195 | * |
||
196 | * @var int |
||
197 | */ |
||
198 | public $widthPrint = 72;//mm |
||
199 | /** |
||
200 | * Maximum width for printed area in dots. |
||
201 | * |
||
202 | * @var int |
||
203 | */ |
||
204 | public $widthMaxdots = 576;//dots |
||
205 | /** |
||
206 | * Maximum number of characters per line. |
||
207 | * |
||
208 | * @var int |
||
209 | */ |
||
210 | public $maxchars = 48;//max characters per line |
||
211 | |||
212 | //protected property standards |
||
213 | /** |
||
214 | * Connector to printer. |
||
215 | * |
||
216 | * @var ConnectosInterface |
||
217 | */ |
||
218 | protected $connector = null; |
||
219 | /** |
||
220 | * Seleted printer mode. |
||
221 | * |
||
222 | * @var string |
||
223 | */ |
||
224 | protected $printerMode = 'normal'; |
||
225 | /** |
||
226 | * Selected bold mode. |
||
227 | * |
||
228 | * @var bool |
||
229 | */ |
||
230 | protected $boldMode = false; |
||
231 | /** |
||
232 | * Selected italic mode. |
||
233 | * |
||
234 | * @var bool |
||
235 | */ |
||
236 | protected $italicMode = false; |
||
237 | /** |
||
238 | * Selected condenced mode. |
||
239 | * |
||
240 | * @var bool |
||
241 | */ |
||
242 | protected $condensedMode = false; |
||
243 | /** |
||
244 | * Selected expanded mode. |
||
245 | * @var bool |
||
246 | */ |
||
247 | protected $expandedMode = false; |
||
248 | /** |
||
249 | * Seleted double higth mode. |
||
250 | * @var bool |
||
251 | */ |
||
252 | protected $doubleHeigth = false; |
||
253 | /** |
||
254 | * Selected reverse colors mode. |
||
255 | * |
||
256 | * @var bool |
||
257 | */ |
||
258 | protected $reverseColors = false; |
||
259 | /** |
||
260 | * Selected under lined mode. |
||
261 | * |
||
262 | * @var bool |
||
263 | */ |
||
264 | protected $underlineMode = false; |
||
265 | /** |
||
266 | * Selected rotate 90 degrees mode |
||
267 | * |
||
268 | * @var bool |
||
269 | */ |
||
270 | protected $rotateMode = false; |
||
271 | /** |
||
272 | * Buffer class. |
||
273 | * |
||
274 | * @var Connectors\Buffer |
||
275 | */ |
||
276 | protected $buffer = null; |
||
277 | /** |
||
278 | * Acceptable barcodes list |
||
279 | * @var array |
||
280 | */ |
||
281 | protected $barcode1Dlist = [ |
||
282 | 'UPC_A' => 65, |
||
283 | 'UPC_E' => 66, |
||
284 | 'EAN13' => 67, |
||
285 | 'EAN8' => 68, |
||
286 | 'CODE39' => 69, |
||
287 | 'I25' => 70, |
||
288 | 'CODABAR' => 71, |
||
289 | 'CODE93' => 72, |
||
290 | 'CODE128' => 73, |
||
291 | 'GS1128' => 74, |
||
292 | 'GS1DATABAROMINI' => 75, |
||
293 | 'GS1DATABARTRUNC' => 76, |
||
294 | 'GS1DATABARLIMIT' => 77, |
||
295 | 'GS1DATABAREXPAN' => 78 |
||
296 | ]; |
||
297 | /** |
||
298 | * List of supported models |
||
299 | * @var array |
||
300 | */ |
||
301 | protected $modelList = [ |
||
302 | 'T20' |
||
303 | ]; |
||
304 | /** |
||
305 | * Selected model |
||
306 | * @var string |
||
307 | */ |
||
308 | protected $printerModel = 'T20'; |
||
309 | |||
310 | /** |
||
311 | * Class constructor |
||
312 | * Instantiates the data buffer. |
||
313 | * |
||
314 | * @param ConnectorInterface $conn |
||
315 | */ |
||
316 | 27 | public function __construct(ConnectorInterface $conn = null) |
|
323 | |||
324 | /** |
||
325 | * Return default printer model |
||
326 | * @param string $model |
||
327 | * @return string|array |
||
328 | */ |
||
329 | 20 | public function defaultModel($model = 'T20') |
|
342 | |||
343 | /** |
||
344 | * Returns a default region for codepage |
||
345 | * if param $region is null will return actual default region from class |
||
346 | * if param $region is 'all' will return a array with all avaiable regions |
||
347 | * if param $region is a string will set the region parameter of class and returns it. |
||
348 | * NOTE: This command do not set the printer, only class parameters |
||
349 | * |
||
350 | * @param string $region |
||
351 | * @return string|array |
||
352 | */ |
||
353 | 21 | public function defaultRegionPage($region = null) |
|
367 | |||
368 | /** |
||
369 | * Returns a default codepage |
||
370 | * if param $codepage is null will return actual default codepage from class |
||
371 | * if param $codepage is 'all' will return a array with all avaiable codepages |
||
372 | * if param $codepage is a string will set the codepage parameter of class and returns it. |
||
373 | * NOTE: This command do not set the printer, only class parameters |
||
374 | * |
||
375 | * @param string $codepage |
||
376 | * @return string|array |
||
377 | */ |
||
378 | 21 | public function defaultCodePage($codepage = null) |
|
393 | |||
394 | /** |
||
395 | * Returns the default printer font |
||
396 | * A - Font A (12 x 24) |
||
397 | * B - Font B (9 x 17) |
||
398 | * C - Font C |
||
399 | * D - Font D |
||
400 | * E - Font E |
||
401 | * Special A |
||
402 | * Special B |
||
403 | * Default Font A. |
||
404 | * if param $font is null will return actual default font from class |
||
405 | * if param $font is 'all' will return a array with all avaiable printer fonts |
||
406 | * if param $font is a string will set the font parameter of class and returns it. |
||
407 | * NOTE: This command do not set the printer, only class parameters |
||
408 | * |
||
409 | * @param string $font |
||
410 | * @return array|string |
||
411 | */ |
||
412 | 22 | public function defaultFont($font = null) |
|
430 | |||
431 | /** |
||
432 | * initialize printer |
||
433 | * Clears the data in the print buffer and resets the printer modes to |
||
434 | * the modes that were in effect when the power was turned on. |
||
435 | */ |
||
436 | 21 | public function initialize() |
|
453 | |||
454 | /** |
||
455 | * Set the printer mode. |
||
456 | */ |
||
457 | abstract public function setPrintMode($mode = null); |
||
458 | |||
459 | /** |
||
460 | * Set a codepage table in printer. |
||
461 | * |
||
462 | * @param string $codepage |
||
463 | */ |
||
464 | 20 | public function setCodePage($codepage = null) |
|
469 | |||
470 | /** |
||
471 | * Set a region page. |
||
472 | * The numeric key of array $this->aRegion is the command parameter. |
||
473 | * |
||
474 | * @param string $region |
||
475 | */ |
||
476 | 20 | public function setRegionPage($region = null) |
|
482 | |||
483 | /** |
||
484 | * Set a printer font |
||
485 | * If send a valid font name will set the printer otherelse a default font is selected |
||
486 | * |
||
487 | * @param string $font |
||
488 | */ |
||
489 | 20 | public function setFont($font = null) |
|
495 | |||
496 | /** |
||
497 | * Set emphasys mode on or off. |
||
498 | */ |
||
499 | 1 | public function setBold() |
|
508 | |||
509 | /** |
||
510 | * Set underline mode on or off. |
||
511 | */ |
||
512 | 1 | public function setUnderlined() |
|
521 | |||
522 | /** |
||
523 | * Set italic mode on or off |
||
524 | * |
||
525 | * @return bool |
||
526 | */ |
||
527 | public function setItalic() |
||
531 | |||
532 | /** |
||
533 | * Aligns all data in one line to the selected layout in standard mode. |
||
534 | * L - left C - center R - rigth |
||
535 | * |
||
536 | * @param string $align |
||
537 | */ |
||
538 | 1 | public function setAlign($align = null) |
|
556 | |||
557 | /** |
||
558 | * Turns white/black reverse print On or Off for characters. |
||
559 | * n = odd: On, n = even: Off. |
||
560 | */ |
||
561 | 1 | public function setReverseColors() |
|
570 | |||
571 | /** |
||
572 | * Set expanded mode. |
||
573 | * |
||
574 | * @param int $size multiplies normal size 1 - 8 |
||
575 | */ |
||
576 | 1 | public function setExpanded($size = null) |
|
592 | |||
593 | /** |
||
594 | * Set condensed mode. |
||
595 | */ |
||
596 | public function setCondensed() |
||
601 | |||
602 | /** |
||
603 | * Set rotate 90 degrees. |
||
604 | */ |
||
605 | 1 | public function setRotate90() |
|
614 | |||
615 | /** |
||
616 | * Send message or command to buffer |
||
617 | * when sending commands is not required to convert characters, |
||
618 | * so the variable may translate by false. |
||
619 | * |
||
620 | * @param string $text |
||
621 | */ |
||
622 | 1 | public function text($text = '') |
|
627 | |||
628 | /** |
||
629 | * Set horizontal and vertical motion units |
||
630 | * $horizontal => character spacing 1/x" |
||
631 | * $vertical => line spacing 1/y". |
||
632 | * |
||
633 | * @param int $horizontal |
||
634 | * @param int $vertical |
||
635 | */ |
||
636 | 1 | public function setSpacing($horizontal = 30, $vertical = 30) |
|
642 | |||
643 | /** |
||
644 | * Set right-side character spacing |
||
645 | * 0 ≤ n ≤ 255 => 1/x". |
||
646 | * |
||
647 | * @param int $value |
||
648 | */ |
||
649 | 1 | public function setCharSpacing($value = 3) |
|
654 | |||
655 | /** |
||
656 | * Line spacing |
||
657 | * The default is set to zero and 30/180 " |
||
658 | * any different number of zero will generate multiples of. |
||
659 | * n 1/180-inch vertical motion |
||
660 | * normal paragraph 30/180" => 4.23 mm |
||
661 | * |
||
662 | * @param int $paragraph |
||
663 | */ |
||
664 | 1 | public function setParagraph($value = 0) |
|
679 | |||
680 | /** |
||
681 | * Prints data and feeds paper n lines |
||
682 | * ESC d n Prints data and feeds paper n lines. |
||
683 | * |
||
684 | * @param integer $lines |
||
685 | */ |
||
686 | 1 | public function lineFeed($lines = 1) |
|
695 | |||
696 | /** |
||
697 | * Prints data and feeds paper n dots |
||
698 | * ESC J n Prints data and feeds paper n dots. |
||
699 | * |
||
700 | * @param int $dots |
||
701 | */ |
||
702 | 1 | public function dotFeed($dots = 1) |
|
707 | |||
708 | /** |
||
709 | * Generate a pulse, for opening a cash drawer if one is connected. |
||
710 | * The default settings should open an Epson drawer. |
||
711 | * |
||
712 | * @param int $pin 0 or 1, for pin 2 or pin 5 kick-out connector respectively. |
||
713 | * @param int $on_ms pulse ON time, in milliseconds. |
||
714 | * @param int $off_ms pulse OFF time, in milliseconds. |
||
715 | */ |
||
716 | 1 | public function pulse($pin = 0, $on_ms = 120, $off_ms = 240) |
|
723 | |||
724 | /** |
||
725 | * Cut the paper. |
||
726 | * |
||
727 | * @param int $mode FULL or PARTIAL. If not specified, FULL will be used. |
||
728 | * @param int $lines Number of lines to feed after cut |
||
729 | */ |
||
730 | 1 | public function cut($mode = 'PARTIAL', $lines = 3) |
|
740 | |||
741 | /** |
||
742 | * Implements barcodes 1D |
||
743 | * GS k m n d1...dn |
||
744 | * Prints bar code. n specifies the data length. |
||
745 | * m bar code system number of d (=k) |
||
746 | * "A" UPC-A 11 or 12 |
||
747 | * "B" UPC-E 6, 7, 8, 11 or 12 |
||
748 | * "C" JAN13 / EAN13 12 or 13 |
||
749 | * "D" JAN8 / EAN8 7 or 8 |
||
750 | * "E" CODE39 1 or more |
||
751 | * "F" ITF even |
||
752 | * "G" CODABAR (NW-7) 2 or more |
||
753 | * "H" CODE93 1–255 |
||
754 | * "I" CODE128 2–255 |
||
755 | * "J" GS1-128 2–255 |
||
756 | * "K" GS1 DataBar Omnidirectional 13 |
||
757 | * "L" GS1 DataBar Truncated 13 |
||
758 | * "M" GS1 DataBar Limited 13 |
||
759 | * "N" GS1 DataBar Expanded 2–255. |
||
760 | * |
||
761 | * GS h n Sets bar code height to n dots. |
||
762 | * GS w n Sets bar width of bar code. n = 2–6 (thin–thick) |
||
763 | * GS H n Selects print position of HRI characters. |
||
764 | * n = 0, "0": Not printed |
||
765 | * n = 1, "1": Above the bar code |
||
766 | * n = 2, "2": Below the bar code |
||
767 | * n = 3, "3": Both above and below the bar code |
||
768 | * GS f n Selects font for the HRI characters. |
||
769 | * n = 0, "0": Font A, |
||
770 | * n = 1, "1": Font B |
||
771 | * |
||
772 | * @param string $data |
||
773 | * @param int $type Default CODE128 |
||
774 | * @param int $height |
||
775 | * @param int $lineWidth |
||
776 | * @param string $txtPosition |
||
777 | * @param string $txtFont |
||
778 | */ |
||
779 | 1 | public function barcode( |
|
829 | |||
830 | /** |
||
831 | * Print PDF 417 2D barcode |
||
832 | * @param string $data |
||
833 | * @param integer $ecc |
||
834 | * @param integer $pheight |
||
835 | * @param integer $pwidth |
||
836 | * @param integer $colunms |
||
837 | * @return boolean |
||
838 | */ |
||
839 | public function barcodePDF417($data = '', $ecc = 5, $pheight = 2, $pwidth = 2, $colunms = 3) |
||
884 | |||
885 | /** |
||
886 | * Prints QRCode |
||
887 | * |
||
888 | * @param string $data barcode data |
||
889 | * @param string $level correction level L,M,Q ou H |
||
890 | * @param int $modelo QRCode model 1, 2 ou 0 Micro |
||
891 | * @param int $wmod width bar 3 ~ 16 |
||
892 | */ |
||
893 | 1 | public function barcodeQRCode($data = '', $level = 'L', $modelo = 2, $wmod = 4) |
|
931 | |||
932 | /** |
||
933 | * Return all data buffer. |
||
934 | * |
||
935 | * @param string $type specifies the return format |
||
936 | */ |
||
937 | 20 | public function getBuffer($type = '') |
|
972 | |||
973 | /** |
||
974 | * Send commands from buffer to connector printer. |
||
975 | */ |
||
976 | public function send(ConnectorInterface $conn = null) |
||
989 | |||
990 | /** |
||
991 | * Insert a image. |
||
992 | * |
||
993 | * @param string $filename Path to image file |
||
994 | * @param float $width |
||
995 | * @param float $height |
||
996 | * @param int $size 0-normal 1-Double Width 2-Double Heigth |
||
997 | * @throws RuntimeException |
||
998 | */ |
||
999 | 1 | public function putImage($filename = '', $width = null, $height = null, $size = 0) |
|
1018 | |||
1019 | /** |
||
1020 | * Close and clean buffer |
||
1021 | * All data will be lost. |
||
1022 | */ |
||
1023 | public function close() |
||
1027 | |||
1028 | /** |
||
1029 | * Wrapper for GS ( L, to calculate and send correct data length. |
||
1030 | * |
||
1031 | * @param string $m Modifier/variant for function. Usually '0'. |
||
1032 | * @param string $fn Function number to use, as character. |
||
1033 | * @param string $data Data to send. |
||
1034 | */ |
||
1035 | 1 | protected function sendGraphicsData($m, $fn, $data = '') |
|
1040 | |||
1041 | /** |
||
1042 | * Generate two characters for a number: |
||
1043 | * In lower and higher parts, or more parts as needed. |
||
1044 | * |
||
1045 | * @param int $int Input number |
||
1046 | * @param int $length The number of bytes to output (1 - 4). |
||
1047 | */ |
||
1048 | 1 | protected static function intLowHigh($input, $length) |
|
1058 | |||
1059 | /** |
||
1060 | * Convert widths and heights to characters. |
||
1061 | * Used before sending graphics to set the size. |
||
1062 | * |
||
1063 | * @param array $inputs |
||
1064 | * @param bool $long True to use 4 bytes, false to use 2 |
||
1065 | * @return string |
||
1066 | */ |
||
1067 | 1 | protected static function dataHeader(array $inputs, $long = true) |
|
1080 | |||
1081 | /** |
||
1082 | * Verify if the argument given is not a boolean. |
||
1083 | * |
||
1084 | * @param bool $test the input to test |
||
1085 | * @param bool $default the default value |
||
1086 | * @return bool |
||
1087 | */ |
||
1088 | protected static function validateBoolean($test, $default) |
||
1095 | |||
1096 | /** |
||
1097 | * Verify if the argument given is not an integer within the specified range. |
||
1098 | * will return default instead |
||
1099 | * |
||
1100 | * @param int $test the input to test |
||
1101 | * @param int $min the minimum allowable value (inclusive) |
||
1102 | * @param int $max the maximum allowable value (inclusive) |
||
1103 | * @param int $default the default value |
||
1104 | * @return int |
||
1105 | */ |
||
1106 | 10 | protected static function validateInteger($test, $min, $max, $default) |
|
1113 | |||
1114 | /** |
||
1115 | * Verify if the argument given can't be cast to a string. |
||
1116 | * |
||
1117 | * @param string $test the input to test |
||
1118 | * @param string $default the default value |
||
1119 | * @return string |
||
1120 | */ |
||
1121 | protected static function validateString($test, $default) |
||
1128 | |||
1129 | /** |
||
1130 | * Translate the text from UTF-8 for the specified codepage |
||
1131 | * this translation uses "iconv" and admits texts ONLY in UTF-8. |
||
1132 | * |
||
1133 | * @param string $text |
||
1134 | * @return string |
||
1135 | */ |
||
1136 | 1 | protected function translate($text = '') |
|
1147 | } |
||
1148 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..