File tree Expand file tree Collapse file tree 5 files changed +35
-53
lines changed Expand file tree Collapse file tree 5 files changed +35
-53
lines changed Original file line number Diff line number Diff line change 4040 "name" : " petrknap/binary" ,
4141 "require" : {
4242 "php" : " >=8.1" ,
43- "petrknap/shorts" : " ^1.5 "
43+ "petrknap/shorts" : " ^2.0 "
4444 },
4545 "require-dev" : {
4646 "ext-mbstring" : " *" ,
Original file line number Diff line number Diff line change 44
55namespace PetrKnap \Binary \Coder ;
66
7- use PetrKnap \Binary \HasRequirementsTrait ;
87use PetrKnap \Shorts \HasRequirements ;
98
109/**
1110 * @see hash()
1211 *
1312 * @link https://en.wikipedia.org/wiki/Checksum
1413 */
15- final class Checksum extends Coder implements HasRequirements
14+ final class Checksum extends Coder
1615{
17- use HasRequirementsTrait ;
16+ use HasRequirements ;
1817
1918 public const ALGORITHM = 'crc32 ' ;
20- private const REQUIRED_FUNCTIONS = [
21- 'mb_strlen ' ,
22- 'mb_strcut ' ,
23- ];
2419
2520 private string $ algorithm ;
2621
2722 public function __construct ()
2823 {
29- self ::checkRequirements ();
24+ self ::checkRequirements (
25+ functions: [
26+ 'mb_strlen ' ,
27+ 'mb_strcut ' ,
28+ ],
29+ );
3030 }
3131
3232 public function encode (string $ decoded , ?string $ algorithm = null ): string
Original file line number Diff line number Diff line change 44
55namespace PetrKnap \Binary \Coder ;
66
7- use PetrKnap \Binary \HasRequirementsTrait ;
87use PetrKnap \Shorts \HasRequirements ;
98
109/**
1110 * @see zlib_encode()
1211 * @see zlib_decode()
1312 */
14- final class Zlib extends Coder implements HasRequirements
13+ final class Zlib extends Coder
1514{
16- use HasRequirementsTrait ;
15+ use HasRequirements ;
1716
1817 public const ENCODING = ZLIB_ENCODING_RAW ;
1918 public const LEVEL = -1 ;
2019 public const MAX_LENGTH = 0 ;
21- private const REQUIRED_FUNCTIONS = [
22- 'zlib_encode ' ,
23- 'zlib_decode ' ,
24- ];
20+
21+ public function __construct ()
22+ {
23+ self ::checkRequirements (
24+ functions: [
25+ 'zlib_encode ' ,
26+ 'zlib_decode ' ,
27+ ],
28+ constants: [
29+ 'ZLIB_ENCODING_RAW ' ,
30+ ],
31+ );
32+ }
2533
2634 private int $ encoding ;
2735 private int $ level ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 44
55namespace PetrKnap \Binary \Serializer ;
66
7- use PetrKnap \Binary \HasRequirementsTrait ;
87use PetrKnap \Shorts \HasRequirements ;
98
109/**
1110 * @see igbinary_serialize()
1211 * @see igbinary_unserialize()
1312 */
14- final class Igbinary extends Serializer implements HasRequirements
13+ final class Igbinary extends Serializer
1514{
16- use HasRequirementsTrait ;
15+ use HasRequirements ;
1716
18- private const REQUIRED_FUNCTIONS = [
19- 'igbinary_serialize ' ,
20- 'igbinary_unserialize ' ,
21- ];
17+ public function __construct ()
18+ {
19+ self ::checkRequirements (
20+ functions: [
21+ 'igbinary_serialize ' ,
22+ 'igbinary_unserialize ' ,
23+ ],
24+ );
25+ }
2226
2327 protected function doSerialize (mixed $ serializable ): string
2428 {
You can’t perform that action at this time.
0 commit comments