escpos-php
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Mike42\Escpos\CapabilityProfile Class Reference

Store compatibility information about one printer. More...

Inheritance diagram for Mike42\Escpos\CapabilityProfile:
Inheritance graph
[legend]

Public Member Functions

 getCodePageCacheKey ()
 
 getCodePages ()
 
 getFeature ($featureName)
 
 getId ()
 
 getName ()
 
 getSupportsBarcodeB ()
 
 getSupportsBitImageRaster ()
 
 getSupportsGraphics ()
 
 getSupportsPdf417Code ()
 
 getSupportsQrCode ()
 
 getSupportsStarCommands ()
 
 getVendor ()
 

Static Public Member Functions

static getProfileNames ()
 
static load (string $profileName)
 Retrieve the CapabilityProfile with the given ID. More...
 
static suggestNearest (string $input, array $choices, int $num)
 Return choices with smallest edit distance to an invalid input. More...
 

Protected Member Functions

 __construct (string $profileId, array $profileData)
 Construct new CapabilityProfile. More...
 
 suggestFeatureName (string $featureName)
 

Static Protected Member Functions

static loadCapabilitiesDataFile ()
 Ensure that the capabilities.json data file has been loaded.
 
static suggestProfileName (string $profileName)
 

Protected Attributes

 $codePageCacheKey
 Hash of the code page data structure, to identify it for caching.
 
 $codePages
 Associtive array of CodePage objects, indicating which encodings the printer supports.
 
 $colors
 Not used.
 
 $features
 Feature values.
 
 $fonts
 Not used.
 
 $media
 Not used.
 
 $name
 Name of the profile, including model number.
 
 $notes
 Notes on the profile, null if not set.
 
 $profileId
 ID of the profile.
 
 $vendor
 Name of manufacturer.
 

Static Protected Attributes

static $encodings = null
 Data structure containing encodings loaded from disk, null if not loaded yet.
 
static $profiles = null
 Data structure containing profiles loaded from disk, null if not loaded yet.
 

Detailed Description

Store compatibility information about one printer.

Constructor & Destructor Documentation

◆ __construct()

Mike42\Escpos\CapabilityProfile::__construct ( string  $profileId,
array  $profileData 
)
protected

Construct new CapabilityProfile.

The encoding data must be loaded from disk before calling.

Parameters
string$profileIdID of the profile
array$profileDataProfile data from disk.

Member Function Documentation

◆ getCodePageCacheKey()

Mike42\Escpos\CapabilityProfile::getCodePageCacheKey ( )
Returns
string Hash of the code page data structure, to identify it for caching.

◆ getCodePages()

Mike42\Escpos\CapabilityProfile::getCodePages ( )
Returns
array Associative array of CodePage objects, indicating which encodings the printer supports.

◆ getFeature()

Mike42\Escpos\CapabilityProfile::getFeature (   $featureName)
Parameters
string$featureNameName of the feature to retrieve.
Exceptions

◆ getId()

Mike42\Escpos\CapabilityProfile::getId ( )
Returns
string ID of the profile.

◆ getName()

Mike42\Escpos\CapabilityProfile::getName ( )
Returns
string Name of the printer.

◆ getProfileNames()

static Mike42\Escpos\CapabilityProfile::getProfileNames ( )
static
Returns
array Names of all profiles that exist.

◆ getSupportsBarcodeB()

Mike42\Escpos\CapabilityProfile::getSupportsBarcodeB ( )
Returns
boolean True if Barcode B command is supported, false otherwise

◆ getSupportsBitImageRaster()

Mike42\Escpos\CapabilityProfile::getSupportsBitImageRaster ( )
Returns
boolean True if Bit Image Raster command is supported, false otherwise

◆ getSupportsGraphics()

Mike42\Escpos\CapabilityProfile::getSupportsGraphics ( )
Returns
boolean True if Graphics command is supported, false otherwise

◆ getSupportsPdf417Code()

Mike42\Escpos\CapabilityProfile::getSupportsPdf417Code ( )
Returns
boolean True if PDF417 code command is supported, false otherwise

◆ getSupportsQrCode()

Mike42\Escpos\CapabilityProfile::getSupportsQrCode ( )
Returns
boolean True if QR code command is supported, false otherwise

◆ getSupportsStarCommands()

Mike42\Escpos\CapabilityProfile::getSupportsStarCommands ( )
Returns
boolean True if Star mode commands are supported, false otherwise

◆ getVendor()

Mike42\Escpos\CapabilityProfile::getVendor ( )
Returns
string Vendor of this printer.

◆ load()

static Mike42\Escpos\CapabilityProfile::load ( string  $profileName)
static

Retrieve the CapabilityProfile with the given ID.

Parameters
string$profileNameThe ID of the profile to load.
Exceptions
InvalidArgumentExceptionWhere the ID does not exist. Some similarly-named profiles will be suggested in the Exception text.
Returns
CapabilityProfile The CapabilityProfile that was requested.

◆ suggestFeatureName()

Mike42\Escpos\CapabilityProfile::suggestFeatureName ( string  $featureName)
protected
Parameters
string$featureNameFeature that does not exist
Returns
array Three most similar feature names that do exist.

◆ suggestNearest()

static Mike42\Escpos\CapabilityProfile::suggestNearest ( string  $input,
array  $choices,
int  $num 
)
static

Return choices with smallest edit distance to an invalid input.

Parameters
string$inputInput that is not a valid choice
array$choicesArray of valid choices.
int$numNumber of suggestions to return

◆ suggestProfileName()

static Mike42\Escpos\CapabilityProfile::suggestProfileName ( string  $profileName)
staticprotected
Parameters
string$profileNameprofile name that does not exist
Returns
array Three similar profile names that do exist, plus 'simple' and 'default' for good measure.

The documentation for this class was generated from the following file: