getPrinter() public method

Used by Escpos to check if a printer is set.
public getPrinter ( )
Ejemplo n.º 1
0
 /**
  * Attach a different print buffer to the printer. Buffers are responsible for handling text output to the printer.
  * 
  * @param PrintBuffer $buffer The buffer to use.
  * @throws InvalidArgumentException Where the buffer is already attached to a different printer.
  */
 function setPrintBuffer(PrintBuffer $buffer)
 {
     if ($buffer === $this->buffer) {
         return;
     }
     if ($buffer->getPrinter() != null) {
         throw new InvalidArgumentException("This buffer is already attached to a printer.");
     }
     if ($this->buffer !== null) {
         $this->buffer->setPrinter(null);
     }
     $this->buffer = $buffer;
     $this->buffer->setPrinter($this);
 }