MabeEnum\EnumSet::count PHP Method

count() public method

Count the number of elements
public count ( ) : integer
return integer
    public function count()
    {
        $count = 0;
        $byteLen = strlen($this->bitset);
        for ($bytePos = 0; $bytePos < $byteLen; ++$bytePos) {
            if ($this->bitset[$bytePos] === "") {
                continue;
                // fast skip null byte
            }
            for ($bitPos = 0; $bitPos < 8; ++$bitPos) {
                if ((ord($this->bitset[$bytePos]) & 1 << $bitPos) !== 0) {
                    ++$count;
                }
            }
        }
        return $count;
    }