mitsuru793 / bit
Bit类,是值对象。
v0.0.1
2020-02-10 18:38 UTC
Requires
- php: >=7.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- phpstan/phpstan: ^0.12.9
- phpunit/phpunit: ^9.0
- symfony/var-dumper: ^5.0
This package is auto-updated.
Last update: 2024-09-11 05:50:56 UTC
README
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');
以下两者都实现了'Bit'接口。请查看测试代码和接口。
- UnlimitedBit
- LimitedBit