FixedBitNotation
in package
The FixedBitNotation class is for binary to text conversion. It can handle many encoding schemes, formally defined or not, that use a fixed number of bits to encode each character.
See also: https://github.com/ademarre/binary-to-text-php/commit/d44968b55fada4c1fac0902f7595b23d2814b2f2
Table of Contents
Properties
- $_bitsPerCharacter : mixed
- $_charmap : mixed
- $_chars : mixed
- $_padCharacter : mixed
- $_padFinalGroup : mixed
- $_radix : mixed
- $_rightPadFinalBits : mixed
Methods
- __construct() : mixed
- Constructor
- decode() : string|null
- Decode a string
- encode() : string
- Encode a string
Properties
$_bitsPerCharacter
protected
mixed
$_bitsPerCharacter
$_charmap
protected
mixed
$_charmap
$_chars
protected
mixed
$_chars
$_padCharacter
protected
mixed
$_padCharacter
$_padFinalGroup
protected
mixed
$_padFinalGroup
$_radix
protected
mixed
$_radix
$_rightPadFinalBits
protected
mixed
$_rightPadFinalBits
Methods
__construct()
Constructor
public
__construct(int $bitsPerCharacter[, string $chars = null ][, bool $rightPadFinalBits = false ][, bool $padFinalGroup = false ][, string $padCharacter = '=' ]) : mixed
Parameters
- $bitsPerCharacter : int
-
Bits to use for each encoded character
- $chars : string = null
-
Base character alphabet
- $rightPadFinalBits : bool = false
-
How to encode last character
- $padFinalGroup : bool = false
-
Add padding to end of encoded output
- $padCharacter : string = '='
-
Character to use for padding
decode()
Decode a string
public
decode(string $encodedString[, bool $caseSensitive = true ][, bool $strict = false ]) : string|null
Parameters
- $encodedString : string
-
Data to decode
- $caseSensitive : bool = true
- $strict : bool = false
-
Returns NULL if $encodedString contains an undecodable character
Return values
string|nullencode()
Encode a string
public
encode(string $rawString) : string
Parameters
- $rawString : string
-
Binary data to encode