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 |
||
| 33 | abstract class DefaultPrinter implements PrinterInterface |
||
| 34 | { |
||
| 35 | //set standards |
||
| 36 | const NUL = "\x0"; //Nulo |
||
| 37 | const EOT = "\x4"; //EOT fim da transmissão |
||
| 38 | const ENQ = "\x5"; //ENQ colocar na fila Pedido de status 1 |
||
| 39 | const HT = "\x9"; //tabulação horizontal |
||
| 40 | const VT = "\xb"; //tabulação vertical |
||
| 41 | const LF = "\x0a"; //Inicia a impressão e avança uma linha |
||
| 42 | const FF = "\x0c"; //avança pagina |
||
| 43 | const CR = "\x0d"; //retorno de carro |
||
| 44 | const DLE = "\x10"; //Data Link Escape |
||
| 45 | const CAN = "\x18"; //CAN Cancela linha enviada |
||
| 46 | const BEL = "\x07"; //BEL sinal sonoro |
||
| 47 | const ESC = "\x1b"; //escape |
||
| 48 | const FS = "\x1c"; //FS |
||
| 49 | const GS = "\x1d"; //GS |
||
| 50 | const SO = "\x0e"; //SO Inicia modo expandido |
||
| 51 | const DC1 = "\x11"; //DC1 Inicia modo enfatizado |
||
| 52 | const DC2 = "\x12"; //DC2 Cancela modo condensado |
||
| 53 | const DC3 = "\x13"; //DC3 Cancela modo enfatizado |
||
| 54 | const DC4 = "\x14"; //DC4 Controle de dispositivo 4 Inicia modo normal |
||
| 55 | const SI = "\x0f"; //Seleciona modo condensado |
||
| 56 | const EM = "\x19"; //Avança 4 linhas |
||
| 57 | const DEL = "\x7f"; //Cancela último caracter |
||
| 58 | const SYN = "\x16"; //Sincronismo |
||
| 59 | const NOTRANS = false; //not translate characters codepage |
||
| 60 | const TRANS = true; //perform a character convertion to codepage |
||
| 61 | |||
| 62 | // Cut types |
||
| 63 | const CUT_FULL = 65; |
||
| 64 | const CUT_PARTIAL = 66; |
||
| 65 | |||
| 66 | //1D barcode types |
||
| 67 | const UPC_A = 'A'; |
||
| 68 | const UPC_E = 'B'; |
||
| 69 | const EAN13 = 'C'; |
||
| 70 | const EAN8 = 'D'; |
||
| 71 | const CODE39 = 'E'; |
||
| 72 | const ITF = 'F'; |
||
| 73 | const CODABAR = 'G'; |
||
| 74 | const CODE93 = 'H'; |
||
| 75 | const CODE128 = 'I'; |
||
| 76 | const GS1_128 = 'J'; |
||
| 77 | const GS1_DataBar_Omnidirectional = 'K'; |
||
| 78 | const GS1_DataBar_Truncated = 'L'; |
||
| 79 | const GS1_DataBar_Limited = 'M'; |
||
| 80 | const GS1_DataBar_Expanded = 'N'; |
||
| 81 | |||
| 82 | /** |
||
| 83 | * List all available region pages. |
||
| 84 | * |
||
| 85 | * @var array |
||
| 86 | */ |
||
| 87 | protected $aRegion = array( |
||
| 88 | 'USA', |
||
| 89 | 'FRANCE', |
||
| 90 | 'GERMANY', |
||
| 91 | 'UK', |
||
| 92 | 'DENMARK', |
||
| 93 | 'SWEDEN', |
||
| 94 | 'ITALY', |
||
| 95 | 'SPAIN', |
||
| 96 | 'JAPAN', |
||
| 97 | 'NORWAY', |
||
| 98 | 'DENMARK2', |
||
| 99 | 'SPAIN2', |
||
| 100 | 'LATIN', |
||
| 101 | 'KOREA', |
||
| 102 | 'SLOVENIA', |
||
| 103 | 'CHINA', |
||
| 104 | 'VIETNAM', |
||
| 105 | 'ARABIA', |
||
| 106 | ); |
||
| 107 | |||
| 108 | /** |
||
| 109 | * List all available code pages. |
||
| 110 | * |
||
| 111 | * @var array |
||
| 112 | */ |
||
| 113 | protected $aCodePage = array( |
||
| 114 | 'CP437' => array('conv' => '437', 'table' => '0', 'desc' => 'PC437: USA, Standard Europe'), |
||
| 115 | 'CP850' => array('conv' => '850', 'table' => '2', 'desc' => 'PC850: Multilingual'), |
||
| 116 | 'CP860' => array('conv' => '860', 'table' => '3', 'desc' => 'PC860: Portuguese'), |
||
| 117 | 'CP863' => array('conv' => '863', 'table' => '4', 'desc' => 'PC863: Canadian-French'), |
||
| 118 | 'CP865' => array('conv' => '865', 'table' => '5', 'desc' => 'PC865: Nordic'), |
||
| 119 | 'CP851' => array('conv' => '851', 'table' => '11', 'desc' => 'PC851: Greek'), |
||
| 120 | 'CP853' => array('conv' => '853', 'table' => '12', 'desc' => 'PC853: Turkish'), |
||
| 121 | 'CP857' => array('conv' => '857', 'table' => '13', 'desc' => 'PC857: Turkish'), |
||
| 122 | 'CP737' => array('conv' => '737', 'table' => '14', 'desc' => 'PC737: Greek'), |
||
| 123 | 'ISO8859-7' => array('conv' => 'ISO8859-7', 'table' => '15', 'desc' => 'ISO8859-7: Greek'), |
||
| 124 | 'CP866' => array('conv' => '866', 'table' => '17', 'desc' => 'PC866: Cyrillic #2'), |
||
| 125 | 'CP852' => array('conv' => '852', 'table' => '18', 'desc' => 'PC852: Latin2'), |
||
| 126 | 'CP858' => array('conv' => '858', 'table' => '19', 'desc' => 'PC858: Euro'), |
||
| 127 | 'CP720' => array('conv' => '720', 'table' => '32', 'desc' => 'PC720: Arabic'), |
||
| 128 | 'CP855' => array('conv' => '855', 'table' => '34', 'desc' => 'PC855: Cyrillic'), |
||
| 129 | 'CP861' => array('conv' => '861', 'table' => '35', 'desc' => 'PC861: Icelandic'), |
||
| 130 | 'CP862' => array('conv' => '862', 'table' => '36', 'desc' => 'PC862: Hebrew'), |
||
| 131 | 'CP864' => array('conv' => '864', 'table' => '37', 'desc' => 'PC864: Arabic'), |
||
| 132 | 'CP869' => array('conv' => '869', 'table' => '38', 'desc' => 'PC869: Greek'), |
||
| 133 | 'ISO8859-2' => array('conv' => 'ISO8859-2', 'table' => '39', 'desc' => 'ISO8859-2: Latin2'), |
||
| 134 | 'ISO8859-15' => array('conv' => 'ISO8859-15', 'table' => '40', 'desc' => 'ISO8859-15: Latin9'), |
||
| 135 | 'WINDOWS-1250' => array('conv' => 'WINDOWS-1250', 'table' => '45', 'desc' => 'WPC1250: Latin2'), |
||
| 136 | 'WINDOWS-1251' => array('conv' => 'WINDOWS-1251', 'table' => '46', 'desc' => 'WPC1251: Cyrillic'), |
||
| 137 | 'WINDOWS-1252' => array('conv' => 'WINDOWS-1252', 'table' => '47', 'desc' => 'WPC1253: Greek'), |
||
| 138 | 'WINDOWS-1254' => array('conv' => 'WINDOWS-1254', 'table' => '48', 'desc' => 'WPC1254: Turkish'), |
||
| 139 | 'WINDOWS-1255' => array('conv' => 'WINDOWS-1255', 'table' => '49', 'desc' => 'WPC1255: Hebrew'), |
||
| 140 | 'WINDOWS-1256' => array('conv' => 'WINDOWS-1256', 'table' => '50', 'desc' => 'WPC1256: Arabic'), |
||
| 141 | 'WINDOWS-1257' => array('conv' => 'WINDOWS-1257', 'table' => '51', 'desc' => 'WPC1257: Baltic Rim'), |
||
| 142 | 'WINDOWS-1258' => array('conv' => 'WINDOWS-1258', 'table' => '52', 'desc' => 'WPC1258: Vietnamese'), |
||
| 143 | ); |
||
| 144 | /** |
||
| 145 | * Seleted code page |
||
| 146 | * Defined in printer class. |
||
| 147 | * |
||
| 148 | * @var string |
||
| 149 | */ |
||
| 150 | protected $codepage = 'CP437'; |
||
| 151 | /** |
||
| 152 | * Number of codpage in printer memory. |
||
| 153 | * |
||
| 154 | * @var int |
||
| 155 | */ |
||
| 156 | protected $charsetTableNum = 0; |
||
| 157 | /** |
||
| 158 | * Selected Region character page |
||
| 159 | * Defined in printer class. |
||
| 160 | * |
||
| 161 | * @var string |
||
| 162 | */ |
||
| 163 | protected $region = 'LATIN'; |
||
| 164 | /** |
||
| 165 | * List all avaiable fonts |
||
| 166 | * @var array |
||
| 167 | */ |
||
| 168 | protected $aFont = array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D', 4 => 'E', 97 => 'SA', 98 => 'SB'); |
||
| 169 | /** |
||
| 170 | * Selected internal font. |
||
| 171 | * |
||
| 172 | * @var string |
||
| 173 | */ |
||
| 174 | protected $font = 'A'; |
||
| 175 | /** |
||
| 176 | * Resolution in dpi. |
||
| 177 | * |
||
| 178 | * @var int |
||
| 179 | */ |
||
| 180 | public $dpi = 203; //dots per inch |
||
| 181 | /** |
||
| 182 | * Resolution in dpmm. |
||
| 183 | * |
||
| 184 | * @var int |
||
| 185 | */ |
||
| 186 | public $dpmm = 8; //dots per mm |
||
| 187 | /** |
||
| 188 | * Maximum width paper. |
||
| 189 | * |
||
| 190 | * @var int |
||
| 191 | */ |
||
| 192 | public $widthMaxmm = 80;//mm |
||
| 193 | /** |
||
| 194 | * Selected Width paper. |
||
| 195 | * |
||
| 196 | * @var int |
||
| 197 | */ |
||
| 198 | public $widthPaper = 80;//mm |
||
| 199 | /** |
||
| 200 | * Maximum width for printed area. |
||
| 201 | * |
||
| 202 | * @var int |
||
| 203 | */ |
||
| 204 | public $widthPrint = 72;//mm |
||
| 205 | /** |
||
| 206 | * Maximum width for printed area in dots. |
||
| 207 | * |
||
| 208 | * @var int |
||
| 209 | */ |
||
| 210 | public $widthMaxdots = 576;//dots |
||
| 211 | /** |
||
| 212 | * Maximum number of characters per line. |
||
| 213 | * |
||
| 214 | * @var int |
||
| 215 | */ |
||
| 216 | public $maxchars = 48;//max characters per line |
||
| 217 | |||
| 218 | //protected property standards |
||
| 219 | /** |
||
| 220 | * Connector to printer. |
||
| 221 | * |
||
| 222 | * @var ConnectosInterface |
||
| 223 | */ |
||
| 224 | protected $connector = null; |
||
| 225 | /** |
||
| 226 | * Seleted printer mode. |
||
| 227 | * |
||
| 228 | * @var string |
||
| 229 | */ |
||
| 230 | protected $printerMode = 'normal'; |
||
| 231 | /** |
||
| 232 | * Selected bold mode. |
||
| 233 | * |
||
| 234 | * @var bool |
||
| 235 | */ |
||
| 236 | protected $boldMode = false; |
||
| 237 | /** |
||
| 238 | * Selected reverse colors mode. |
||
| 239 | * |
||
| 240 | * @var bool |
||
| 241 | */ |
||
| 242 | protected $reverseColors = false; |
||
| 243 | /** |
||
| 244 | * Selected under lined mode. |
||
| 245 | * |
||
| 246 | * @var bool |
||
| 247 | */ |
||
| 248 | protected $underlineMode = false; |
||
| 249 | /** |
||
| 250 | * Selected rotate 90 degrees mode |
||
| 251 | * @var bool |
||
| 252 | */ |
||
| 253 | protected $rotateMode = false; |
||
| 254 | /** |
||
| 255 | * Buffer class. |
||
| 256 | * |
||
| 257 | * @var Connectors\Buffer |
||
| 258 | */ |
||
| 259 | protected $buffer = null; |
||
| 260 | |||
| 261 | /** |
||
| 262 | * Class constructor |
||
| 263 | * Instantiates the data buffer. |
||
| 264 | * |
||
| 265 | * @param ConnectorInterface $conn |
||
| 266 | */ |
||
| 267 | 24 | public function __construct(ConnectorInterface $conn = null) |
|
| 274 | |||
| 275 | /** |
||
| 276 | * Returns a default region for codepage |
||
| 277 | * if param $region is null will return actual default region from class |
||
| 278 | * if param $region is 'all' will return a array with all avaiable regions |
||
| 279 | * if param $region is a string will set the region parameter of class and returns it. |
||
| 280 | * NOTE: This command do not set the printer, only class parameters |
||
| 281 | * |
||
| 282 | * @param string $region |
||
| 283 | * @return string|array |
||
| 284 | */ |
||
| 285 | 2 | public function defaultRegionPage($region = null) |
|
| 299 | |||
| 300 | /** |
||
| 301 | * Returns a default codepage |
||
| 302 | * if param $codepage is null will return actual default codepage from class |
||
| 303 | * if param $codepage is 'all' will return a array with all avaiable codepages |
||
| 304 | * if param $codepage is a string will set the codepage parameter of class and returns it. |
||
| 305 | * NOTE: This command do not set the printer, only class parameters |
||
| 306 | * |
||
| 307 | * @param string $codepage |
||
| 308 | * @return string|array |
||
| 309 | */ |
||
| 310 | 21 | public function defaultCodePage($codepage = null) |
|
| 325 | |||
| 326 | /** |
||
| 327 | * Set a codepage table in printer. |
||
| 328 | * |
||
| 329 | * @param string $codepage |
||
| 330 | */ |
||
| 331 | 2 | public function setCodePage($codepage = null) |
|
| 336 | |||
| 337 | /** |
||
| 338 | * Set a region page. |
||
| 339 | * The numeric key of array $this->aRegion is the command parameter. |
||
| 340 | * |
||
| 341 | * @param string $region |
||
| 342 | */ |
||
| 343 | 1 | public function setRegionPage($region = null) |
|
| 349 | |||
| 350 | /** |
||
| 351 | * Returns the default printer font |
||
| 352 | * A - Font A (12 x 24) |
||
| 353 | * B - Font B (9 x 17) |
||
| 354 | * C - Font C |
||
| 355 | * D - Font D |
||
| 356 | * E - Font E |
||
| 357 | * Special A |
||
| 358 | * Special B |
||
| 359 | * Default Font A. |
||
| 360 | * if param $font is null will return actual default font from class |
||
| 361 | * if param $font is 'all' will return a array with all avaiable printer fonts |
||
| 362 | * if param $font is a string will set the font parameter of class and returns it. |
||
| 363 | * NOTE: This command do not set the printer, only class parameters |
||
| 364 | * |
||
| 365 | * @param string $font |
||
| 366 | * @return array|string |
||
| 367 | */ |
||
| 368 | 2 | public function defaultFont($font = null) |
|
| 386 | |||
| 387 | /** |
||
| 388 | * Set a printer font |
||
| 389 | * If send a valid font name will set the printer otherelse a default font is selected |
||
| 390 | * @param string $font |
||
| 391 | */ |
||
| 392 | 1 | public function setFont($font = null) |
|
| 398 | |||
| 399 | /** |
||
| 400 | * Set emphasys mode on or off. |
||
| 401 | */ |
||
| 402 | 1 | public function setBold() |
|
| 413 | |||
| 414 | /** |
||
| 415 | * Set underline mode on or off. |
||
| 416 | */ |
||
| 417 | 1 | public function setUnderlined() |
|
| 428 | |||
| 429 | /** |
||
| 430 | * Aligns all data in one line to the selected layout in standard mode. |
||
| 431 | * L - left C - center R - rigth |
||
| 432 | * |
||
| 433 | * @param string $align |
||
| 434 | */ |
||
| 435 | 1 | public function setAlign($align = null) |
|
| 453 | |||
| 454 | /** |
||
| 455 | * Turns white/black reverse print On or Off for characters. |
||
| 456 | * n = odd: On, n = even: Off. |
||
| 457 | */ |
||
| 458 | 1 | public function setReverseColors() |
|
| 469 | |||
| 470 | /** |
||
| 471 | * Set expanded mode. |
||
| 472 | * @param int $size multiplies normal size 1 - 8 |
||
| 473 | */ |
||
| 474 | 1 | public function setExpanded($size = null) |
|
| 490 | |||
| 491 | /** |
||
| 492 | * Set condensed mode. |
||
| 493 | */ |
||
| 494 | public function setCondensed() |
||
| 499 | |||
| 500 | |||
| 501 | /** |
||
| 502 | * Set the printer mode. |
||
| 503 | */ |
||
| 504 | abstract public function setPrintMode($mode = null); |
||
| 505 | |||
| 506 | /** |
||
| 507 | * Set rotate 90 degrees. |
||
| 508 | */ |
||
| 509 | 1 | public function setRotate90() |
|
| 520 | |||
| 521 | /** |
||
| 522 | * initialize printer |
||
| 523 | * Clears the data in the print buffer and resets the printer modes to |
||
| 524 | * the modes that were in effect when the power was turned on. |
||
| 525 | */ |
||
| 526 | 20 | public function initialize() |
|
| 536 | |||
| 537 | /** |
||
| 538 | * Send message or command to buffer |
||
| 539 | * when sending commands is not required to convert characters, |
||
| 540 | * so the variable may translate by false. |
||
| 541 | * |
||
| 542 | * @param string $text |
||
| 543 | */ |
||
| 544 | 1 | public function text($text = '') |
|
| 549 | |||
| 550 | /** |
||
| 551 | * Set horizontal and vertical motion units |
||
| 552 | * $horizontal => character spacing 1/x" |
||
| 553 | * $vertical => line spacing 1/y". |
||
| 554 | * |
||
| 555 | * @param int $horizontal |
||
| 556 | * @param int $vertical |
||
| 557 | */ |
||
| 558 | 1 | public function setSpacing($horizontal = 30, $vertical = 30) |
|
| 564 | |||
| 565 | /** |
||
| 566 | * Set right-side character spacing |
||
| 567 | * 0 ≤ n ≤ 255 => 1/x". |
||
| 568 | * |
||
| 569 | * @param int $value |
||
| 570 | */ |
||
| 571 | 1 | public function setCharSpacing($value = 3) |
|
| 576 | |||
| 577 | /** |
||
| 578 | * Line spacing |
||
| 579 | * The default is set to zero and 30/180 " |
||
| 580 | * any different number of zero will generate multiples of. |
||
| 581 | * n 1/180-inch vertical motion |
||
| 582 | * normal paragraph 30/180" => 4.23 mm |
||
| 583 | * |
||
| 584 | * @param int $paragraph |
||
| 585 | */ |
||
| 586 | 1 | public function setParagraph($value = 0) |
|
| 601 | |||
| 602 | /** |
||
| 603 | * Prints data and feeds paper n lines |
||
| 604 | * ESC d n Prints data and feeds paper n lines. |
||
| 605 | * |
||
| 606 | * @param type $lines |
||
| 607 | */ |
||
| 608 | 1 | public function lineFeed($lines = 1) |
|
| 617 | |||
| 618 | /** |
||
| 619 | * Prints data and feeds paper n dots |
||
| 620 | * ESC J n Prints data and feeds paper n dots. |
||
| 621 | * |
||
| 622 | * @param int $dots |
||
| 623 | */ |
||
| 624 | 1 | public function dotFeed($dots = 1) |
|
| 629 | |||
| 630 | /** |
||
| 631 | * Generate a pulse, for opening a cash drawer if one is connected. |
||
| 632 | * The default settings should open an Epson drawer. |
||
| 633 | * |
||
| 634 | * @param int $pin 0 or 1, for pin 2 or pin 5 kick-out connector respectively. |
||
| 635 | * @param int $on_ms pulse ON time, in milliseconds. |
||
| 636 | * @param int $off_ms pulse OFF time, in milliseconds. |
||
| 637 | */ |
||
| 638 | 1 | public function pulse($pin = 0, $on_ms = 120, $off_ms = 240) |
|
| 645 | |||
| 646 | /** |
||
| 647 | * Cut the paper. |
||
| 648 | * |
||
| 649 | * @param int $mode FULL or PARTIAL. If not specified, FULL will be used. |
||
| 650 | * @param int $lines Number of lines to feed after cut |
||
| 651 | */ |
||
| 652 | 1 | public function cut($mode = 'PARTIAL', $lines = 3) |
|
| 662 | |||
| 663 | /** |
||
| 664 | * Implements barcodes 1D |
||
| 665 | * GS k m n d1...dn |
||
| 666 | * Prints bar code. n specifies the data length. |
||
| 667 | * m bar code system number of d (=k) |
||
| 668 | * "A" UPC-A 11 or 12 |
||
| 669 | * "B" UPC-E 6, 7, 8, 11 or 12 |
||
| 670 | * "C" JAN13 / EAN13 12 or 13 |
||
| 671 | * "D" JAN8 / EAN8 7 or 8 |
||
| 672 | * "E" CODE39 1 or more |
||
| 673 | * "F" ITF even |
||
| 674 | * "G" CODABAR (NW-7) 2 or more |
||
| 675 | * "H" CODE93 1–255 |
||
| 676 | * "I" CODE128 2–255 |
||
| 677 | * "J" GS1-128 2–255 |
||
| 678 | * "K" GS1 DataBar Omnidirectional 13 |
||
| 679 | * "L" GS1 DataBar Truncated 13 |
||
| 680 | * "M" GS1 DataBar Limited 13 |
||
| 681 | * "N" GS1 DataBar Expanded 2–255. |
||
| 682 | * |
||
| 683 | * GS h n Sets bar code height to n dots. |
||
| 684 | * GS w n Sets bar width of bar code. n = 2–6 (thin–thick) |
||
| 685 | * GS H n Selects print position of HRI characters. |
||
| 686 | * n = 0, "0": Not printed |
||
| 687 | * n = 1, "1": Above the bar code |
||
| 688 | * n = 2, "2": Below the bar code |
||
| 689 | * n = 3, "3": Both above and below the bar code |
||
| 690 | * GS f n Selects font for the HRI characters. |
||
| 691 | * n = 0, "0": Font A, |
||
| 692 | * n = 1, "1": Font B |
||
| 693 | * |
||
| 694 | * @param int $type Default CODE128 |
||
| 695 | * @param int $height |
||
| 696 | * @param int $lineWidth |
||
| 697 | * @param string $txtPosition |
||
| 698 | * @param string $txtFont |
||
| 699 | * @param string $data |
||
| 700 | */ |
||
| 701 | 1 | public function barcode( |
|
| 745 | |||
| 746 | /** |
||
| 747 | * Imprime o QR Code |
||
| 748 | * @param string $data Dados a serem inseridos no QRCode |
||
| 749 | * @param string $level Nivel de correção L,M,Q ou H |
||
| 750 | * @param int $modelo modelo de QRCode 1, 2 ou 0 Micro |
||
| 751 | * @param int $wmod largura da barra 3 ~ 16 |
||
| 752 | */ |
||
| 753 | 1 | public function barcodeQRCode($data = '', $level = 'L', $modelo = 2, $wmod = 4) |
|
| 790 | |||
| 791 | /** |
||
| 792 | * Close and clean buffer |
||
| 793 | * All data will be lost. |
||
| 794 | */ |
||
| 795 | public function close() |
||
| 799 | |||
| 800 | /** |
||
| 801 | * Return all data buffer. |
||
| 802 | * |
||
| 803 | * @param string $type specifies the return format |
||
| 804 | */ |
||
| 805 | 20 | public function getBuffer($type = '') |
|
| 840 | |||
| 841 | /** |
||
| 842 | * Send commands from buffer to connector printer. |
||
| 843 | */ |
||
| 844 | public function send(ConnectorInterface $conn = null) |
||
| 857 | |||
| 858 | /** |
||
| 859 | * Checks whether the barcode data is compatible with the chosen model |
||
| 860 | * |
||
| 861 | * @param string $type |
||
| 862 | * @param int $id |
||
| 863 | * @param string $data |
||
| 864 | * @return string |
||
| 865 | */ |
||
| 866 | 1 | protected static function validateBarcodeData($type, &$id, &$data) |
|
| 898 | |||
| 899 | /** |
||
| 900 | * Insert a image. |
||
| 901 | * |
||
| 902 | * @param string $filename Path to image file |
||
| 903 | * @param float $width |
||
| 904 | * @param float $height |
||
| 905 | * @throws RuntimeException |
||
| 906 | */ |
||
| 907 | public function putImage($filename = '', $width = null, $height = null) |
||
| 925 | |||
| 926 | /** |
||
| 927 | * Calculate the size of the word. |
||
| 928 | * |
||
| 929 | * @param string $data |
||
| 930 | */ |
||
| 931 | protected function getWordLength($data = '') |
||
| 936 | |||
| 937 | /** |
||
| 938 | * Generate two characters for a number: |
||
| 939 | * In lower and higher parts, or more parts as needed. |
||
| 940 | * |
||
| 941 | * @param int $int Input number |
||
| 942 | * @param int $length The number of bytes to output (1 - 4). |
||
| 943 | */ |
||
| 944 | protected static function intLowHigh($input, $length) |
||
| 954 | |||
| 955 | /** |
||
| 956 | * Convert widths and heights to characters. |
||
| 957 | * Used before sending graphics to set the size. |
||
| 958 | * |
||
| 959 | * @param array $inputs |
||
| 960 | * @param bool $long True to use 4 bytes, false to use 2 |
||
| 961 | * @return string |
||
| 962 | */ |
||
| 963 | protected static function dataHeader(array $inputs, $long = true) |
||
| 976 | |||
| 977 | /** |
||
| 978 | * Verify if the argument given is not a boolean. |
||
| 979 | * |
||
| 980 | * @param bool $test the input to test |
||
| 981 | * @param bool $default the default value |
||
| 982 | * @return bool |
||
| 983 | */ |
||
| 984 | protected static function validateBoolean($test, $default) |
||
| 991 | |||
| 992 | /** |
||
| 993 | * Verify if the argument given is not an integer within the specified range. |
||
| 994 | * will return default instead |
||
| 995 | * |
||
| 996 | * @param int $test the input to test |
||
| 997 | * @param int $min the minimum allowable value (inclusive) |
||
| 998 | * @param int $max the maximum allowable value (inclusive) |
||
| 999 | * @param int $default the default value |
||
| 1000 | * @return int |
||
| 1001 | */ |
||
| 1002 | 9 | protected static function validateInteger($test, $min, $max, $default) |
|
| 1009 | |||
| 1010 | /** |
||
| 1011 | * Verify if the argument given can't be cast to a string. |
||
| 1012 | * |
||
| 1013 | * @param string $test the input to test |
||
| 1014 | * @param string $default the default value |
||
| 1015 | * @return string |
||
| 1016 | */ |
||
| 1017 | protected static function validateString($test, $default) |
||
| 1024 | |||
| 1025 | /** |
||
| 1026 | * Translate the text from UTF-8 for the specified codepage |
||
| 1027 | * this translation uses "iconv" and admits texts ONLY in UTF-8. |
||
| 1028 | * |
||
| 1029 | * @param string $text |
||
| 1030 | * @return string |
||
| 1031 | */ |
||
| 1032 | 1 | protected function translate($text = '') |
|
| 1043 | |||
| 1044 | /** |
||
| 1045 | * Wrapper for GS ( L, to calculate and send correct data length. |
||
| 1046 | * |
||
| 1047 | * @param string $m Modifier/variant for function. Usually '0'. |
||
| 1048 | * @param string $fn Function number to use, as character. |
||
| 1049 | * @param string $data Data to send. |
||
| 1050 | * |
||
| 1051 | * @throws InvalidArgumentException Where the input lengths are bad. |
||
| 1052 | */ |
||
| 1053 | private function sendGraphicsData($m, $fn, $data = '') |
||
| 1061 | } |
||
| 1062 |
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..