public function testSuggestions()
 {
     $input = "orangee";
     $choices = array("apple", "orange", "pear");
     $suggestions = CapabilityProfile::suggestNearest($input, $choices, 1);
     $this->assertEquals(1, count($suggestions));
     $this->assertEquals("orange", $suggestions[0]);
 }
Example #2
0
 /**
  * Switch character table (code page) manually. Used in conjunction with textRaw() to
  * print special characters which can't be encoded automatically.
  *
  * @param int $table The table to select. Available code tables are model-specific.
  */
 public function selectCharacterTable($table = 0)
 {
     self::validateInteger($table, 0, 255, __FUNCTION__);
     $supported = $this->profile->getCodePages();
     if (!isset($supported[$table])) {
         throw new InvalidArgumentException("There is no code table {$table} allowed by this printer's capability profile.");
     }
     $this->characterTable = $table;
     if ($this->profile->getSupportsStarCommands()) {
         /* Not an ESC/POS command: STAR printers stash all the extra code pages under a different command. */
         $this->connector->write(self::ESC . self::GS . "t" . chr($table));
         return;
     }
     $this->connector->write(self::ESC . "t" . chr($table));
 }
 public static function getInstance()
 {
     return CapabilityProfile::load('P822D');
 }
 public static function getInstance()
 {
     return CapabilityProfile::load('TEP-200M');
 }