# woocommerce-pos/1.10.20/vendor_prefixed/chillerlan/php-qrcode/src/Data/QRDataModeAbstract.php

WCPOS – Point of Sale (POS) plugin for WooCommerce, version 1.10.20. 58 lines.

- Page: https://pluginprobe.com/plugins/woocommerce-pos/1.10.20/code/vendor_prefixed/chillerlan/php-qrcode/src/Data/QRDataModeAbstract.php
- Raw: https://pluginprobe.com/plugins/woocommerce-pos/1.10.20/raw/vendor_prefixed/chillerlan/php-qrcode/src/Data/QRDataModeAbstract.php
- Modified: 2026-06-09T13:55:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/woocommerce-pos/1.10.20/code/vendor_prefixed/chillerlan/php-qrcode/src/Data/QRDataModeAbstract.php#L10-L20`.

```php
<?php

/**
 * Class QRDataModeAbstract
 *
 * @created      19.11.2020
 * @author       smiley <smiley@chillerlan.net>
 * @copyright    2020 smiley
 * @license      MIT
 */
namespace WCPOS\Vendor\chillerlan\QRCode\Data;

use WCPOS\Vendor\chillerlan\QRCode\Common\Mode;
/**
 * abstract methods for the several data modes
 */
abstract class QRDataModeAbstract implements QRDataModeInterface
{
    /**
     * The data to write
     */
    protected string $data;
    /**
     * QRDataModeAbstract constructor.
     *
     * @throws \chillerlan\QRCode\Data\QRCodeDataException
     */
    public function __construct(string $data)
    {
        $data = $this::convertEncoding($data);
        if (!$this::validateString($data)) {
            throw new QRCodeDataException('invalid data');
        }
        $this->data = $data;
    }
    /**
     * returns the character count of the $data string
     */
    protected function getCharCount() : int
    {
        return \strlen($this->data);
    }
    /**
     * @inheritDoc
     */
    public static function convertEncoding(string $string) : string
    {
        return $string;
    }
    /**
     * shortcut
     */
    protected static function getLengthBits(int $versionNumber) : int
    {
        return Mode::getLengthBitsForVersion(static::DATAMODE, $versionNumber);
    }
}

```
