escpos-php
|
Main class for ESC/POS code generation. More...
Public Member Functions | |
__construct (PrintConnector $connector, CapabilityProfile $profile=null) | |
Construct a new print object. More... | |
barcode (string $content, int $type=Printer::BARCODE_CODE39) | |
Print a barcode. More... | |
bitImage (EscposImage $img, int $size=Printer::IMG_DEFAULT) | |
Print an image, using the older "bit image" command. More... | |
bitImageColumnFormat (EscposImage $img, int $size=Printer::IMG_DEFAULT) | |
Print an image, using the older "bit image" command in column format. More... | |
close () | |
Close the underlying buffer. More... | |
cut (int $mode=Printer::CUT_FULL, int $lines=3) | |
Cut the paper. More... | |
feed (int $lines=1) | |
Print and feed line / Print and feed n lines. More... | |
feedForm () | |
Some printers require a form feed to release the paper. More... | |
release () | |
Some slip printers require ESC q sequence to release the paper. | |
feedReverse (int $lines=1) | |
Print and reverse feed n lines. More... | |
getCharacterTable () | |
getPrintBuffer () | |
getPrintConnector () | |
getPrinterCapabilityProfile () | |
graphics (EscposImage $img, int $size=Printer::IMG_DEFAULT) | |
Print an image to the printer. More... | |
initialize () | |
Initialize printer. More... | |
pdf417Code (string $content, int $width=3, int $heightMultiplier=3, int $dataColumnCount=0, float $ec=0.10, int $options=Printer::PDF417_STANDARD) | |
Print a two-dimensional data code using the PDF417 standard. More... | |
pulse (int $pin=0, int $on_ms=120, int $off_ms=240) | |
Generate a pulse, for opening a cash drawer if one is connected. More... | |
qrCode (string $content, int $ec=Printer::QR_ECLEVEL_L, int $size=3, int $model=Printer::QR_MODEL_2) | |
Print the given data as a QR code on the printer. More... | |
selectCharacterTable (int $table=0) | |
Switch character table (code page) manually. More... | |
selectPrintMode (int $mode=Printer::MODE_FONT_A) | |
Select print mode(s). More... | |
selectUserDefinedCharacterSet ($on=true) | |
Select user-defined character set. More... | |
setBarcodeHeight (int $height=8) | |
Set barcode height. More... | |
setBarcodeWidth (int $width=3) | |
Set barcode bar width. More... | |
setBarcodeTextPosition (int $position=Printer::BARCODE_TEXT_NONE) | |
Set the position for the Human Readable Interpretation (HRI) of barcode characters. More... | |
setDoubleStrike (bool $on=true) | |
Turn double-strike mode on/off. More... | |
setColor (int $color=Printer::COLOR_1) | |
Select print color on printers that support multiple colors. More... | |
setEmphasis (bool $on=true) | |
Turn emphasized mode on/off. More... | |
setFont (int $font=Printer::FONT_A) | |
Select font. More... | |
setJustification (int $justification=Printer::JUSTIFY_LEFT) | |
Select justification. More... | |
setLineSpacing (int $height=null) | |
Set the height of the line. More... | |
setPrintLeftMargin (int $margin=0) | |
Set print area left margin. More... | |
setPrintWidth (int $width=512) | |
Set print area width. More... | |
setPrintBuffer (PrintBuffer $buffer) | |
Attach a different print buffer to the printer. More... | |
setReverseColors (bool $on=true) | |
Set black/white reverse mode on or off. More... | |
setTextSize (int $widthMultiplier, int $heightMultiplier) | |
Set the size of text, as a multiple of the normal size. More... | |
setUnderline (int $underline=Printer::UNDERLINE_SINGLE) | |
Set underline for printed text. More... | |
setUpsideDown (bool $on=true) | |
Print each line upside-down (180 degrees rotated). More... | |
text (string $str) | |
Add text to the buffer. More... | |
textChinese (string $str="") | |
Add Chinese text to the buffer. More... | |
textRaw (string $str="") | |
Add text to the buffer without attempting to interpret chararacter codes. More... | |
Public Attributes | |
const | NUL = "\x00" |
ASCII null control character. | |
const | LF = "\x0a" |
ASCII linefeed control character. | |
const | ESC = "\x1b" |
ASCII escape control character. | |
const | FS = "\x1c" |
ASCII form separator control character. | |
const | FF = "\x0c" |
ASCII form feed control character. | |
const | GS = "\x1d" |
ASCII group separator control character. | |
const | DLE = "\x10" |
ASCII data link escape control character. | |
const | EOT = "\x04" |
ASCII end of transmission control character. | |
const | BARCODE_UPCA = 65 |
Indicates UPC-A barcode when used with Printer::barcode. | |
const | BARCODE_UPCE = 66 |
Indicates UPC-E barcode when used with Printer::barcode. | |
const | BARCODE_JAN13 = 67 |
Indicates JAN13 barcode when used with Printer::barcode. | |
const | BARCODE_JAN8 = 68 |
Indicates JAN8 barcode when used with Printer::barcode. | |
const | BARCODE_CODE39 = 69 |
Indicates CODE39 barcode when used with Printer::barcode. | |
const | BARCODE_ITF = 70 |
Indicates ITF barcode when used with Printer::barcode. | |
const | BARCODE_CODABAR = 71 |
Indicates CODABAR barcode when used with Printer::barcode. | |
const | BARCODE_CODE93 = 72 |
Indicates CODE93 barcode when used with Printer::barcode. | |
const | BARCODE_CODE128 = 73 |
Indicates CODE128 barcode when used with Printer::barcode. | |
const | BARCODE_TEXT_NONE = 0 |
Indicates that HRI (human-readable interpretation) text should not be printed, when used with Printer::setBarcodeTextPosition. | |
const | BARCODE_TEXT_ABOVE = 1 |
Indicates that HRI (human-readable interpretation) text should be printed above a barcode, when used with Printer::setBarcodeTextPosition. | |
const | BARCODE_TEXT_BELOW = 2 |
Indicates that HRI (human-readable interpretation) text should be printed below a barcode, when used with Printer::setBarcodeTextPosition. | |
const | COLOR_1 = 0 |
Use the first color (usually black), when used with Printer::setColor. | |
const | COLOR_2 = 1 |
Use the second color (usually red or blue), when used with Printer::setColor. | |
const | CUT_FULL = 65 |
Make a full cut, when used with Printer::cut. | |
const | CUT_PARTIAL = 66 |
Make a partial cut, when used with Printer::cut. | |
const | FONT_A = 0 |
Use Font A, when used with Printer::setFont. | |
const | FONT_B = 1 |
Use Font B, when used with Printer::setFont. | |
const | FONT_C = 2 |
Use Font C, when used with Printer::setFont. | |
const | IMG_DEFAULT = 0 |
Use default (high density) image size, when used with Printer::graphics, Printer::bitImage or Printer::bitImageColumnFormat. | |
const | IMG_DOUBLE_WIDTH = 1 |
Use lower horizontal density for image printing, when used with Printer::graphics, Printer::bitImage or Printer::bitImageColumnFormat. | |
const | IMG_DOUBLE_HEIGHT = 2 |
Use lower vertical density for image printing, when used with Printer::graphics, Printer::bitImage or Printer::bitImageColumnFormat. | |
const | JUSTIFY_LEFT = 0 |
Align text to the left, when used with Printer::setJustification. | |
const | JUSTIFY_CENTER = 1 |
Center text, when used with Printer::setJustification. | |
const | JUSTIFY_RIGHT = 2 |
Align text to the right, when used with Printer::setJustification. | |
const | MODE_FONT_A = 0 |
Use Font A, when used with Printer::selectPrintMode. | |
const | MODE_FONT_B = 1 |
Use Font B, when used with Printer::selectPrintMode. | |
const | MODE_EMPHASIZED = 8 |
Use text emphasis, when used with Printer::selectPrintMode. | |
const | MODE_DOUBLE_HEIGHT = 16 |
Use double height text, when used with Printer::selectPrintMode. | |
const | MODE_DOUBLE_WIDTH = 32 |
Use double width text, when used with Printer::selectPrintMode. | |
const | MODE_UNDERLINE = 128 |
Underline text, when used with Printer::selectPrintMode. | |
const | PDF417_STANDARD = 0 |
Indicates standard PDF417 code. | |
const | PDF417_TRUNCATED = 1 |
Indicates truncated PDF417 code. | |
const | QR_ECLEVEL_L = 0 |
Indicates error correction level L when used with Printer::qrCode. | |
const | QR_ECLEVEL_M = 1 |
Indicates error correction level M when used with Printer::qrCode. | |
const | QR_ECLEVEL_Q = 2 |
Indicates error correction level Q when used with Printer::qrCode. | |
const | QR_ECLEVEL_H = 3 |
Indicates error correction level H when used with Printer::qrCode. | |
const | QR_MODEL_1 = 1 |
Indicates QR model 1 when used with Printer::qrCode. | |
const | QR_MODEL_2 = 2 |
Indicates QR model 2 when used with Printer::qrCode. | |
const | QR_MICRO = 3 |
Indicates micro QR code when used with Printer::qrCode. | |
const | STATUS_PRINTER = 1 |
Indicates a request for printer status when used with Printer::getPrinterStatus (experimental) | |
const | STATUS_OFFLINE_CAUSE = 2 |
Indicates a request for printer offline cause when used with Printer::getPrinterStatus (experimental) | |
const | STATUS_ERROR_CAUSE = 3 |
Indicates a request for error cause when used with Printer::getPrinterStatus (experimental) | |
const | STATUS_PAPER_ROLL = 4 |
Indicates a request for error cause when used with Printer::getPrinterStatus (experimental) | |
const | STATUS_INK_A = 7 |
Indicates a request for ink A status when used with Printer::getPrinterStatus (experimental) | |
const | STATUS_INK_B = 6 |
Indicates a request for ink B status when used with Printer::getPrinterStatus (experimental) | |
const | STATUS_PEELER = 8 |
Indicates a request for peeler status when used with Printer::getPrinterStatus (experimental) | |
const | UNDERLINE_NONE = 0 |
Indicates no underline when used with Printer::setUnderline. | |
const | UNDERLINE_SINGLE = 1 |
Indicates single underline when used with Printer::setUnderline. | |
const | UNDERLINE_DOUBLE = 2 |
Indicates double underline when used with Printer::setUnderline. | |
Protected Member Functions | |
wrapperSend2dCodeData (string $fn, string $cn, string $data='', string $m='') | |
Wrapper for GS ( k, to calculate and send correct data length. More... | |
wrapperSendGraphicsData (string $m, string $fn, string $data='') | |
Wrapper for GS ( L, to calculate and send correct data length. More... | |
Static Protected Member Functions | |
static | dataHeader (array $inputs, bool $long=true) |
Convert widths and heights to characters. More... | |
static | intLowHigh (int $input, int $length) |
Generate two characters for a number: In lower and higher parts, or more parts as needed. More... | |
static | validateBoolean (bool $test, string $source) |
Throw an exception if the argument given is not a boolean. More... | |
static | validateFloat (float $test, float $min, float $max, string $source, string $argument="Argument") |
Throw an exception if the argument given is not a float within the specified range. More... | |
static | validateInteger (int $test, int $min, int $max, string $source, string $argument="Argument") |
Throw an exception if the argument given is not an integer within the specified range. More... | |
static | validateIntegerMulti (int $test, array $ranges, string $source, string $argument="Argument") |
Throw an exception if the argument given is not an integer within one of the specified ranges. More... | |
static | validateStringRegex (string $test, string $source, string $regex, string $argument="Argument") |
Throw an exception if the argument doesn't match the given regex. More... | |
Protected Attributes | |
$buffer | |
The printer's output buffer. | |
$connector | |
Connector showing how to print to this printer. | |
$profile | |
Profile showing supported features for this printer. | |
$characterTable | |
Current character code table. | |
Main class for ESC/POS code generation.
Mike42\Escpos\Printer::__construct | ( | PrintConnector | $connector, |
CapabilityProfile | $profile = null |
||
) |
Construct a new print object.
PrintConnector | $connector | The PrintConnector to send data to. If not set, output is sent to standard output. |
CapabilityProfile | null | $profile | Supported features of this printer. If not set, the "default" CapabilityProfile will be used, which is suitable for Epson printers. |
InvalidArgumentException |
Mike42\Escpos\Printer::barcode | ( | string | $content, |
int | $type = Printer::BARCODE_CODE39 |
||
) |
Print a barcode.
string | $content | The information to encode. |
int | $type | The barcode standard to output. Supported values are Printer::BARCODE_UPCA , Printer::BARCODE_UPCE , Printer::BARCODE_JAN13 , Printer::BARCODE_JAN8 , Printer::BARCODE_CODE39 , Printer::BARCODE_ITF , Printer::BARCODE_CODABAR , Printer::BARCODE_CODE93 , and Printer::BARCODE_CODE128 . If not specified, Printer::BARCODE_CODE39 will be used. Note that some barcode formats only support specific lengths or sets of characters, and that available barcode types vary between printers. |
InvalidArgumentException | Where the length or characters used in $content is invalid for the requested barcode format. |
Mike42\Escpos\Printer::bitImage | ( | EscposImage | $img, |
int | $size = Printer::IMG_DEFAULT |
||
) |
Print an image, using the older "bit image" command.
This creates padding on the right of the image, if its width is not divisible by 8.
Should only be used if your printer does not support the graphics() command. See also bitImageColumnFormat().
EscposImage | $img | The image to print |
int | $size | Size modifier for the image. Must be either Printer::IMG_DEFAULT (default), or any combination of the Printer::IMG_DOUBLE_HEIGHT and Printer::IMG_DOUBLE_WIDTH flags. |
Mike42\Escpos\Printer::bitImageColumnFormat | ( | EscposImage | $img, |
int | $size = Printer::IMG_DEFAULT |
||
) |
Print an image, using the older "bit image" command in column format.
Should only be used if your printer does not support the graphics() or bitImage() commands.
EscposImage | $img | The image to print |
int | $size | Size modifier for the image. Must be either Printer::IMG_DEFAULT (default), or any combination of the Printer::IMG_DOUBLE_HEIGHT and Printer::IMG_DOUBLE_WIDTH flags. |
Mike42\Escpos\Printer::close | ( | ) |
Close the underlying buffer.
With some connectors, the job will not actually be sent to the printer until this is called.
Mike42\Escpos\Printer::cut | ( | int | $mode = Printer::CUT_FULL , |
int | $lines = 3 |
||
) |
Cut the paper.
int | $mode | Cut mode, either Printer::CUT_FULL or Printer::CUT_PARTIAL. If not specified, Printer::CUT_FULL will be used. |
int | $lines | Number of lines to feed |
|
staticprotected |
Convert widths and heights to characters.
Used before sending graphics to set the size.
array | $inputs | |
boolean | $long | True to use 4 bytes, false to use 2 |
Mike42\Escpos\Printer::feed | ( | int | $lines = 1 | ) |
Print and feed line / Print and feed n lines.
int | $lines | Number of lines to feed |
Mike42\Escpos\Printer::feedForm | ( | ) |
Some printers require a form feed to release the paper.
On most printers, this command is only useful in page mode, which is not implemented in this driver.
Mike42\Escpos\Printer::feedReverse | ( | int | $lines = 1 | ) |
Print and reverse feed n lines.
int | $lines | number of lines to feed. If not specified, 1 line will be fed. |
Mike42\Escpos\Printer::getCharacterTable | ( | ) |
Mike42\Escpos\Printer::getPrintBuffer | ( | ) |
Mike42\Escpos\Printer::getPrintConnector | ( | ) |
Mike42\Escpos\Printer::getPrinterCapabilityProfile | ( | ) |
Mike42\Escpos\Printer::graphics | ( | EscposImage | $img, |
int | $size = Printer::IMG_DEFAULT |
||
) |
Print an image to the printer.
Size modifiers are:
See the example/ folder for detailed examples.
The functions bitImage() and bitImageColumnFormat() take the same parameters, and can be used if your printer doesn't support the newer graphics commands.
EscposImage | $img | The image to print. |
int | $size | Size modifier for the image. Must be either Printer::IMG_DEFAULT (default), or any combination of the Printer::IMG_DOUBLE_HEIGHT and Printer::IMG_DOUBLE_WIDTH flags. |
Mike42\Escpos\Printer::initialize | ( | ) |
Initialize printer.
This resets formatting back to the defaults.
|
staticprotected |
Generate two characters for a number: In lower and higher parts, or more parts as needed.
int | $input | Input number |
int | $length | The number of bytes to output (1 - 4). |
Mike42\Escpos\Printer::pdf417Code | ( | string | $content, |
int | $width = 3 , |
||
int | $heightMultiplier = 3 , |
||
int | $dataColumnCount = 0 , |
||
float | $ec = 0.10 , |
||
int | $options = Printer::PDF417_STANDARD |
||
) |
Print a two-dimensional data code using the PDF417 standard.
string | $content | Text or numbers to store in the code |
int | $width | Width of a module (pixel) in the printed code. Default is 3 dots. |
int | $heightMultiplier | Multiplier for height of a module. Default is 3 times the width. |
int | $dataColumnCount | Number of data columns to use. 0 (default) is to auto-calculate. Smaller numbers will result in a narrower code, making larger pixel sizes possible. Larger numbers require smaller pixel sizes. |
float | $ec | Error correction ratio, from 0.01 to 4.00. Default is 0.10 (10%). |
int | $options | Standard code Printer::PDF417_STANDARD with start/end bars, or truncated code Printer::PDF417_TRUNCATED with start bars only. |
Exception | If this profile indicates that PDF417 code is not supported |
Mike42\Escpos\Printer::pulse | ( | int | $pin = 0 , |
int | $on_ms = 120 , |
||
int | $off_ms = 240 |
||
) |
Generate a pulse, for opening a cash drawer if one is connected.
The default settings should open an Epson drawer.
int | $pin | 0 or 1, for pin 2 or pin 5 kick-out connector respectively. |
int | $on_ms | pulse ON time, in milliseconds. |
int | $off_ms | pulse OFF time, in milliseconds. |
Mike42\Escpos\Printer::qrCode | ( | string | $content, |
int | $ec = Printer::QR_ECLEVEL_L , |
||
int | $size = 3 , |
||
int | $model = Printer::QR_MODEL_2 |
||
) |
Print the given data as a QR code on the printer.
string | $content | The content of the code. Numeric data will be more efficiently compacted. |
int | $ec | Error-correction level to use. One of Printer::QR_ECLEVEL_L (default), Printer::QR_ECLEVEL_M, Printer::QR_ECLEVEL_Q or Printer::QR_ECLEVEL_H. Higher error correction results in a less compact code. |
int | $size | Pixel size to use. Must be 1-16 (default 3) |
int | $model | QR code model to use. Must be one of Printer::QR_MODEL_1, Printer::QR_MODEL_2 (default) or Printer::QR_MICRO (not supported by all printers). |
Mike42\Escpos\Printer::selectCharacterTable | ( | int | $table = 0 | ) |
Switch character table (code page) manually.
Used in conjunction with textRaw() to print special characters which can't be encoded automatically.
int | $table | The table to select. Available code tables are model-specific. |
Mike42\Escpos\Printer::selectPrintMode | ( | int | $mode = Printer::MODE_FONT_A | ) |
Select print mode(s).
Several MODE_* constants can be OR'd together passed to this function's $mode
argument. The valid modes are:
int | $mode | The mode to use. Default is Printer::MODE_FONT_A, with no special formatting. This has a similar effect to running initialize(). |
Mike42\Escpos\Printer::selectUserDefinedCharacterSet | ( | $on = true | ) |
Select user-defined character set.
bool | $on | True to enable user-defined character set, false to use built-in characters sets. |
Mike42\Escpos\Printer::setBarcodeHeight | ( | int | $height = 8 | ) |
Set barcode height.
int | $height | Height in dots. If not specified, 8 will be used. |
Mike42\Escpos\Printer::setBarcodeTextPosition | ( | int | $position = Printer::BARCODE_TEXT_NONE | ) |
Set the position for the Human Readable Interpretation (HRI) of barcode characters.
int | $position,. | Use Printer::BARCODE_TEXT_NONE to hide the text (default), or any combination of Printer::BARCODE_TEXT_ABOVE and Printer::BARCODE_TEXT_BELOW flags to display the text. |
Mike42\Escpos\Printer::setBarcodeWidth | ( | int | $width = 3 | ) |
Set barcode bar width.
int | $width | Bar width in dots. If not specified, 3 will be used. Values above 6 appear to have no effect. |
Mike42\Escpos\Printer::setColor | ( | int | $color = Printer::COLOR_1 | ) |
Select print color on printers that support multiple colors.
int | $color | Color to use. Must be either Printer::COLOR_1 (default), or Printer::COLOR_2. |
Mike42\Escpos\Printer::setDoubleStrike | ( | bool | $on = true | ) |
Turn double-strike mode on/off.
boolean | $on | true for double strike, false for no double strike |
Mike42\Escpos\Printer::setEmphasis | ( | bool | $on = true | ) |
Turn emphasized mode on/off.
boolean | $on | true for emphasis, false for no emphasis |
Mike42\Escpos\Printer::setFont | ( | int | $font = Printer::FONT_A | ) |
Select font.
Most printers have two fonts (Fonts A and B), and some have a third (Font C).
int | $font | The font to use. Must be either Printer::FONT_A, Printer::FONT_B, or Printer::FONT_C. |
Mike42\Escpos\Printer::setJustification | ( | int | $justification = Printer::JUSTIFY_LEFT | ) |
Select justification.
int | $justification | One of Printer::JUSTIFY_LEFT, Printer::JUSTIFY_CENTER, or Printer::JUSTIFY_RIGHT. |
Mike42\Escpos\Printer::setLineSpacing | ( | int | $height = null | ) |
Set the height of the line.
Some printers will allow you to overlap lines with a smaller line feed.
int | null | $height | The height of each line, in dots. If not set, the printer will reset to its default line spacing. |
Mike42\Escpos\Printer::setPrintBuffer | ( | PrintBuffer | $buffer | ) |
Attach a different print buffer to the printer.
Buffers are responsible for handling text output to the printer.
PrintBuffer | $buffer | The buffer to use. |
InvalidArgumentException | Where the buffer is already attached to a different printer. |
Mike42\Escpos\Printer::setPrintLeftMargin | ( | int | $margin = 0 | ) |
Set print area left margin.
Reset to default with Printer::initialize()
int | $margin | The left margin to set on to the print area, in dots. |
Mike42\Escpos\Printer::setPrintWidth | ( | int | $width = 512 | ) |
Set print area width.
This can be used to add a right margin to the print area. Reset to default with Printer::initialize()
int | $width | The width of the page print area, in dots. |
Mike42\Escpos\Printer::setReverseColors | ( | bool | $on = true | ) |
Set black/white reverse mode on or off.
In this mode, text is printed white on a black background.
boolean | $on | True to enable, false to disable. |
Mike42\Escpos\Printer::setTextSize | ( | int | $widthMultiplier, |
int | $heightMultiplier | ||
) |
Set the size of text, as a multiple of the normal size.
int | $widthMultiplier | Multiple of the regular height to use (range 1 - 8) |
int | $heightMultiplier | Multiple of the regular height to use (range 1 - 8) |
Mike42\Escpos\Printer::setUnderline | ( | int | $underline = Printer::UNDERLINE_SINGLE | ) |
Set underline for printed text.
int | $underline | Either true/false, or one of Printer::UNDERLINE_NONE, Printer::UNDERLINE_SINGLE or Printer::UNDERLINE_DOUBLE. Defaults to Printer::UNDERLINE_SINGLE. |
Mike42\Escpos\Printer::setUpsideDown | ( | bool | $on = true | ) |
Print each line upside-down (180 degrees rotated).
boolean | $on | True to enable, false to disable. |
Mike42\Escpos\Printer::text | ( | string | $str | ) |
Add text to the buffer.
Text should either be followed by a line-break, or feed() should be called after this to clear the print buffer.
string | $str | Text to print, as UTF-8 |
Mike42\Escpos\Printer::textChinese | ( | string | $str = "" | ) |
Add Chinese text to the buffer.
This is a specific workaround for Zijang printers- The printer will be switched to a two-byte mode and sent GBK-encoded text.
Support for this will be merged into a print buffer.
string | $str | Text to print, as UTF-8 |
Mike42\Escpos\Printer::textRaw | ( | string | $str = "" | ) |
Add text to the buffer without attempting to interpret chararacter codes.
Text should either be followed by a line-break, or feed() should be called after this to clear the print buffer.
string | $str | Text to print |
|
staticprotected |
Throw an exception if the argument given is not a boolean.
boolean | $test | the input to test |
string | $source | the name of the function calling this |
|
staticprotected |
Throw an exception if the argument given is not a float within the specified range.
float | $test | the input to test |
float | $min | the minimum allowable value (inclusive) |
float | $max | the maximum allowable value (inclusive) |
string | $source | the name of the function calling this |
string | $argument | the name of the invalid parameter |
|
staticprotected |
Throw an exception if the argument given is not an integer within the specified range.
int | $test | the input to test |
int | $min | the minimum allowable value (inclusive) |
int | $max | the maximum allowable value (inclusive) |
string | $source | the name of the function calling this |
string | $argument | the name of the invalid parameter |
|
staticprotected |
Throw an exception if the argument given is not an integer within one of the specified ranges.
int | $test | the input to test |
array | $ranges | array of two-item min/max ranges. |
string | $source | the name of the function calling this |
string | $source | the name of the function calling this |
string | $argument | the name of the invalid parameter |
|
staticprotected |
Throw an exception if the argument doesn't match the given regex.
string | $test | the input to test |
string | $source | the name of the function calling this |
string | $regex | valid values for this attribute, as a regex |
string | $argument | the name of the parameter being validated |
InvalidArgumentException | Where the argument is not valid |
|
protected |
Wrapper for GS ( k, to calculate and send correct data length.
string | $fn | Function to use |
string | $cn | Output code type. Affects available data |
string | $data | Data to send. |
string | $m | Modifier/variant for function. Often '0' where used. |
InvalidArgumentException | Where the input lengths are bad. |
|
protected |
Wrapper for GS ( L, to calculate and send correct data length.
string | $m | Modifier/variant for function. Usually '0'. |
string | $fn | Function number to use, as character. |
string | $data | Data to send. |
InvalidArgumentException | Where the input lengths are bad. |