Mike42\Escpos\CodePage::getData PHP Метод

getData() публичный Метод

It will be calculated and cached if it was not previously known.
public getData ( ) : string
Результат string Data for this encoding.
    public function getData()
    {
        if ($this->data !== null) {
            // Return data if known
            return $this->data;
        }
        if ($this->iconv !== null) {
            // Calculate with iconv if we know the encoding name
            $this->data = self::generateEncodingMap($this->iconv);
            return $this->data;
        }
        // Can't encode..
        throw new InvalidArgumentException("Cannot encode this code page");
    }

Usage Example

Пример #1
0
 public function testDataCannotEncode()
 {
     $this->setExpectedException('\\InvalidArgumentException');
     $cp = new CodePage("foo", array("name" => "foo"));
     $this->assertFalse($cp->isEncodable());
     $cp->getData();
 }