Skip to content

Latest commit

 

History

History
445 lines (189 loc) · 5.75 KB

File metadata and controls

445 lines (189 loc) · 5.75 KB

Mode

Enum representing various modes in which data can be encoded to bits.

  • Full name: \BaconQrCode\Common\Mode
  • Parent class: \DASPRiD\Enum\AbstractEnum
  • This class is marked as final and can't be subclassed
  • This class is a Final class

Constants

Constant Visibility Type Value
TERMINATOR protected [[0, 0, 0], 0x0]
NUMERIC protected [[10, 12, 14], 0x1]
ALPHANUMERIC protected [[9, 11, 13], 0x2]
STRUCTURED_APPEND protected [[0, 0, 0], 0x3]
BYTE protected [[8, 16, 16], 0x4]
ECI protected [[0, 0, 0], 0x7]
KANJI protected [[8, 10, 12], 0x8]
FNC1_FIRST_POSITION protected [[0, 0, 0], 0x5]
FNC1_SECOND_POSITION protected [[0, 0, 0], 0x9]
HANZI protected [[8, 10, 12], 0xd]

Properties

characterCountBitsForVersions

private int[] $characterCountBitsForVersions

bits

private int $bits

Methods

__construct

The constructor is private by default to avoid arbitrary enum creation.

protected __construct(array $characterCountBitsForVersions, int $bits): mixed

When creating your own constructor for a parameterized enum, make sure to declare it as protected, so that the static methods are able to construct it. Avoid making it public, as that would allow creation of non-singleton enum instances.

Parameters:

Parameter Type Description
$characterCountBitsForVersions array
$bits int

getCharacterCountBits

Returns the number of bits used in a specific QR code version.

public getCharacterCountBits(\BaconQrCode\Common\Version $version): int

Parameters:

Parameter Type Description
$version \BaconQrCode\Common\Version

getBits

Returns the four bits used to encode this mode.

public getBits(): int

Inherited methods

__construct

The constructor is private by default to avoid arbitrary enum creation.

private __construct(): mixed

When creating your own constructor for a parameterized enum, make sure to declare it as protected, so that the static methods are able to construct it. Avoid making it public, as that would allow creation of non-singleton enum instances.


__callStatic

Magic getter which forwards all calls to {@see self::valueOf()}.

final public static __callStatic(string $name, array $arguments): static
  • This method is static.

  • This method is final.

Parameters:

Parameter Type Description
$name string
$arguments array

valueOf

Returns an enum with the specified name.

final public static valueOf(string $name): static

The name must match exactly an identifier used to declare an enum in this type (extraneous whitespace characters are not permitted).

  • This method is static.

  • This method is final.

Parameters:

Parameter Type Description
$name string

createValue

private static createValue(string $name, int $ordinal, array $arguments): static
  • This method is static.

Parameters:

Parameter Type Description
$name string
$ordinal int
$arguments array

values

Obtains all possible types defined by this enum.

final public static values(): static[]
  • This method is static.

  • This method is final.


constants

private static constants(): array
  • This method is static.

name

Returns the name of this enum constant, exactly as declared in its enum declaration.

final public name(): string

Most programmers should use the {@see} method in preference to this one, as the toString method may return a more user-friendly name. This method is designed primarily for use in specialized situations where correctness depends on getting the exact name, which will not vary from release to release.

  • This method is final.

ordinal

Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).

final public ordinal(): int

Most programmers will have no use for this method. It is designed for use by sophisticated enum-based data structures.

  • This method is final.

compareTo

Compares this enum with the specified object for order.

final public compareTo(self $other): int

Returns negative integer, zero or positive integer as this object is less than, equal to or greater than the specified object.

Enums are only comparable to other enums of the same type. The natural order implemented by this method is the order in which the constants are declared.

  • This method is final.

Parameters:

Parameter Type Description
$other self

__clone

Forbid cloning enums.

final public __clone(): mixed
  • This method is final.

__sleep

Forbid serializing enums.

final public __sleep(): array
  • This method is final.

__wakeup

Forbid unserializing enums.

final public __wakeup(): void
  • This method is final.

__toString

Turns the enum into a string representation.

public __toString(): string

You may override this method to give a more user-friendly version.