private static function setParityBit($byte)
    {
        $parity = 1;

        for ($i = 1; $i < 8; $i++) {
            $parity = ($parity + (($byte >> $i) & 1)) %2;
        }

        $byte = $byte | ($parity & 1);

        return $byte;
    }