classByteChoices
final class ByteChoices
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Consumes input choices while constructing an immutable generation plan.
Methods§
public function __construct(private string $bytes)Captures one stream for this plan construction only.
Parameters
$bytes | string |
public function index(int $count): ?intReturns a choice, or null when a complete choice is unavailable.
Parameters
$count | int |
Returns
?intThrows
InvalidArgumentException When the candidate count is not positiveTest cases 4
Called from 2
Calls 3
- static-call ByteChoices::width() line 32
- function-call
strlenline 33 - function-call
ordline 39
public static function encode(int $count, int $index): stringWrites the little-endian bytes index() reads back as the same choice; the index must select one of the candidates.
Parameters
$count | int | |
$index | int |
Returns
stringThrows
InvalidArgumentException When the candidate count is not positiveTest cases 1
Called from 2
Calls 2
- static-call ByteChoices::width() line 59
- function-call
chrline 60
public static function width(int $count): intCounts the little-endian bytes used by both encoder and decoder.
Parameters
$count | int |
Returns
intThrows
InvalidArgumentException When the candidate count is not positiveTest cases 1
Called from 2
Private surface 2§
Implementation details, listed for orientation only.
private int $position = 0private string $bytesTest cases 14§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
ByteChoicesTest::testEncodeWritesTheLittleEndianBytesIndexReadsBackcallsByteChoicesTest::testIndexConsumesLittleEndianChoicesWiderThanOneBytecallsByteChoicesTest::testIndexDoesNotUseAnIncompleteChoicecallsByteChoicesTest::testIndexReducesUnsignedEightByteValuesWithoutIntegerOverflowcallsByteChoicesTest::testWidthUsesTheMinimumNumberOfBytesWithoutAssuming256Alternativescalls
Other tests reaching this symbol 9
BytePlanCompilerTestcallsBytePlanEncoderTestcallsPlanBuilderTestcallsCoverageSnapshotStoreTestcallsGrammarCoverageInventoryTestcallsGrammarCoverageTestcallsSnapshotValidationTestcallsDerivationNodeTestcallsSqlGeneratorTestcalls