@@ -65,8 +65,8 @@ class EnumSet implements Iterator, Countable
6565 */
6666 public function __construct ($ enumeration )
6767 {
68- if (!is_subclass_of ($ enumeration , Enum::class)) {
69- throw new InvalidArgumentException (sprintf (
68+ if (!\ is_subclass_of ($ enumeration , Enum::class)) {
69+ throw new InvalidArgumentException (\ sprintf (
7070 "%s can handle subclasses of '%s' only " ,
7171 static ::class,
7272 Enum::class
@@ -81,7 +81,7 @@ public function __construct($enumeration)
8181 // we will switch this into a binary bitset
8282 if ($ this ->ordinalMax > \PHP_INT_SIZE * 8 ) {
8383 // init binary bitset with zeros
84- $ this ->bitset = str_repeat ("\0" , ceil ($ this ->ordinalMax / 8 ));
84+ $ this ->bitset = \ str_repeat ("\0" , ceil ($ this ->ordinalMax / 8 ));
8585
8686 // switch internal binary bitset functions
8787 $ this ->fnDoRewind = 'doRewindBin ' ;
@@ -203,7 +203,7 @@ public function rewind()
203203 */
204204 private function doRewindBin ()
205205 {
206- if (ltrim ($ this ->bitset , "\0" ) !== '' ) {
206+ if (\ ltrim ($ this ->bitset , "\0" ) !== '' ) {
207207 $ this ->ordinal = -1 ;
208208 $ this ->next ();
209209 } else {
@@ -267,14 +267,14 @@ private function doCountBin()
267267 {
268268 $ count = 0 ;
269269 $ bitset = $ this ->bitset ;
270- $ byteLen = strlen ($ bitset );
270+ $ byteLen = \ strlen ($ bitset );
271271 for ($ bytePos = 0 ; $ bytePos < $ byteLen ; ++$ bytePos ) {
272272 if ($ bitset [$ bytePos ] === "\0" ) {
273273 // fast skip null byte
274274 continue ;
275275 }
276276
277- $ ord = ord ($ bitset [$ bytePos ]);
277+ $ ord = \ ord ($ bitset [$ bytePos ]);
278278 for ($ bitPos = 0 ; $ bitPos < 8 ; ++$ bitPos ) {
279279 if ($ ord & (1 << $ bitPos )) {
280280 ++$ count ;
@@ -470,14 +470,14 @@ private function doGetOrdinalsBin()
470470 {
471471 $ ordinals = [];
472472 $ bitset = $ this ->bitset ;
473- $ byteLen = strlen ($ bitset );
473+ $ byteLen = \ strlen ($ bitset );
474474 for ($ bytePos = 0 ; $ bytePos < $ byteLen ; ++$ bytePos ) {
475475 if ($ bitset [$ bytePos ] === "\0" ) {
476476 // fast skip null byte
477477 continue ;
478478 }
479479
480- $ ord = ord ($ bitset [$ bytePos ]);
480+ $ ord = \ ord ($ bitset [$ bytePos ]);
481481 for ($ bitPos = 0 ; $ bitPos < 8 ; ++$ bitPos ) {
482482 if ($ ord & (1 << $ bitPos )) {
483483 $ ordinals [] = $ bytePos * 8 + $ bitPos ;
@@ -582,8 +582,8 @@ private function doGetBinaryBitsetLeBin()
582582 */
583583 private function doGetBinaryBitsetLeInt ()
584584 {
585- $ bin = pack (\PHP_INT_SIZE === 8 ? 'P ' : 'V ' , $ this ->bitset );
586- return substr ($ bin , 0 , ceil ($ this ->ordinalMax / 8 ));
585+ $ bin = \ pack (\PHP_INT_SIZE === 8 ? 'P ' : 'V ' , $ this ->bitset );
586+ return \ substr ($ bin , 0 , \ ceil ($ this ->ordinalMax / 8 ));
587587 }
588588
589589 /**
@@ -597,7 +597,7 @@ private function doGetBinaryBitsetLeInt()
597597 */
598598 public function setBinaryBitsetLe ($ bitset )
599599 {
600- if (!is_string ($ bitset )) {
600+ if (!\ is_string ($ bitset )) {
601601 throw new InvalidArgumentException ('Bitset must be a string ' );
602602 }
603603
@@ -618,29 +618,29 @@ public function setBinaryBitsetLe($bitset)
618618 */
619619 private function doSetBinaryBitsetLeBin ($ bitset )
620620 {
621- $ size = strlen ($ this ->bitset );
622- $ sizeIn = strlen ($ bitset );
621+ $ size = \ strlen ($ this ->bitset );
622+ $ sizeIn = \ strlen ($ bitset );
623623
624624 if ($ sizeIn < $ size ) {
625625 // add "\0" if the given bitset is not long enough
626- $ bitset .= str_repeat ("\0" , $ size - $ sizeIn );
626+ $ bitset .= \ str_repeat ("\0" , $ size - $ sizeIn );
627627 } elseif ($ sizeIn > $ size ) {
628- if (ltrim (substr ($ bitset , $ size ), "\0" ) !== '' ) {
628+ if (\ ltrim (\ substr ($ bitset , $ size ), "\0" ) !== '' ) {
629629 throw new InvalidArgumentException ('Out-Of-Range bits detected ' );
630630 }
631- $ bitset = substr ($ bitset , 0 , $ size );
631+ $ bitset = \ substr ($ bitset , 0 , $ size );
632632 }
633633
634634 // truncate out-of-range bits of last byte
635635 $ lastByteMaxOrd = $ this ->ordinalMax % 8 ;
636636 if ($ lastByteMaxOrd !== 0 ) {
637637 $ lastByte = $ bitset [$ size - 1 ];
638- $ lastByteExpected = chr ((1 << $ lastByteMaxOrd ) - 1 ) & $ lastByte ;
638+ $ lastByteExpected = \ chr ((1 << $ lastByteMaxOrd ) - 1 ) & $ lastByte ;
639639 if ($ lastByte !== $ lastByteExpected ) {
640640 throw new InvalidArgumentException ('Out-Of-Range bits detected ' );
641641 }
642642
643- $ this ->bitset = substr ($ bitset , 0 , -1 ) . $ lastByteExpected ;
643+ $ this ->bitset = \ substr ($ bitset , 0 , -1 ) . $ lastByteExpected ;
644644 }
645645
646646 $ this ->bitset = $ bitset ;
@@ -657,10 +657,10 @@ private function doSetBinaryBitsetLeBin($bitset)
657657 */
658658 private function doSetBinaryBitsetLeInt ($ bitset )
659659 {
660- $ len = strlen ($ bitset );
660+ $ len = \ strlen ($ bitset );
661661 $ int = 0 ;
662662 for ($ i = 0 ; $ i < $ len ; ++$ i ) {
663- $ ord = ord ($ bitset [$ i ]);
663+ $ ord = \ ord ($ bitset [$ i ]);
664664
665665 if ($ ord && $ i > \PHP_INT_SIZE - 1 ) {
666666 throw new InvalidArgumentException ('Out-Of-Range bits detected ' );
@@ -683,7 +683,7 @@ private function doSetBinaryBitsetLeInt($bitset)
683683 */
684684 public function getBinaryBitsetBe ()
685685 {
686- return strrev ($ this ->bitset );
686+ return \ strrev ($ this ->bitset );
687687 }
688688
689689 /**
@@ -697,10 +697,10 @@ public function getBinaryBitsetBe()
697697 */
698698 public function setBinaryBitsetBe ($ bitset )
699699 {
700- if (!is_string ($ bitset )) {
700+ if (!\ is_string ($ bitset )) {
701701 throw new InvalidArgumentException ('Bitset must be a string ' );
702702 }
703- $ this ->setBinaryBitsetLe (strrev ($ bitset ));
703+ $ this ->setBinaryBitsetLe (\ strrev ($ bitset ));
704704 }
705705
706706 /**
@@ -730,7 +730,7 @@ public function getBit($ordinal)
730730 */
731731 private function doGetBitBin ($ ordinal )
732732 {
733- return (ord ($ this ->bitset [(int ) ($ ordinal / 8 )]) & 1 << ($ ordinal % 8 )) !== 0 ;
733+ return (\ ord ($ this ->bitset [(int ) ($ ordinal / 8 )]) & 1 << ($ ordinal % 8 )) !== 0 ;
734734 }
735735
736736 /**
@@ -785,7 +785,7 @@ public function setBit($ordinal, $bit)
785785 private function doSetBitBin ($ ordinal )
786786 {
787787 $ byte = (int ) ($ ordinal / 8 );
788- $ this ->bitset [$ byte ] = $ this ->bitset [$ byte ] | chr (1 << ($ ordinal % 8 ));
788+ $ this ->bitset [$ byte ] = $ this ->bitset [$ byte ] | \ chr (1 << ($ ordinal % 8 ));
789789 }
790790
791791 /**
@@ -816,7 +816,7 @@ private function doSetBitInt($ordinal)
816816 private function doUnsetBitBin ($ ordinal )
817817 {
818818 $ byte = (int ) ($ ordinal / 8 );
819- $ this ->bitset [$ byte ] = $ this ->bitset [$ byte ] & chr (~(1 << ($ ordinal % 8 )));
819+ $ this ->bitset [$ byte ] = $ this ->bitset [$ byte ] & \ chr (~(1 << ($ ordinal % 8 )));
820820 }
821821
822822 /**
0 commit comments