Bit Class which is Value Object.

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 1

pkg:composer/mitsuru793/bit

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

This package is auto-updated.

Last update: 2025-10-06 20:14:41 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