QrEncodingMode

Backed enum for the QR Code data encoding mode hint.

Table of contents

Namespace: Com\Tecnick\Barcode\Type\Square\QrCode

enum QrEncodingMode: string

Source: src/Type/Square/QrCode/QrEncodingMode.php:36

Backed enum for the QR Code data encoding mode hint. The backing value of each case is the token accepted as the second parameter of QrCode. Only KJ changes the encoder behaviour, by adding the kanji mode to the modes it may use.

Cases

  • NL = 'NL': Variable, the numeric, alphanumeric and byte modes mixed.
  • NM = 'NM': Numeric, kept for compatibility and equivalent to NL.
  • AN = 'AN': Alphanumeric, kept for compatibility and equivalent to NL.
  • Byte = '8B': 8-bit byte, kept for compatibility and equivalent to NL.
  • KJ = 'KJ': Kanji, which adds the kanji mode to the modes of NL.
  • ST = 'ST': Structured append, which is not implemented and is equivalent to NL.

Methods

fromLoose()

Resolve a loose encoding mode value to the matching enum case.

Accepts the canonical token or an enum instance (returned unchanged). Unknown values fall back to Byte (8B), matching the lenient behavior of QrCode.

public static fromLoose(string|self $value): self

Parameters:

  • $value (string|self): Encoding mode token or enum case.

Returns: self

Source: src/Type/Square/QrCode/QrEncodingMode.php:65