Bit Class which is Value Object.

v0.0.1 2020-02-10 18:38 UTC

This package is auto-updated.

Last update: 2025-04-06 19:09:51 UTC


README

Build Status

PHP Bit

// construct
$bit = new UnlimitedBit(2);
$bit = new UnlimitedBit('0010');

assert($bit->asInt() === 2);
assert($bit->asSTr() === '10');

// immutable
assert($bit->on(4)->asStr() === '1010');
assert($bit->asStr() === '10');

assert($bit->on(4)->off(2)->asStr() === '1000');

Both of the followings implement interface 'Bit'. Please see test codes and interface.

  • UnlimitedBit
  • LimitedBit