MabeEnum\EnumSet::symDiff PHP Method

symDiff() public method

Produce a new set with enumerators in either this and other but not in both (this ^ (other | other))
public symDiff ( EnumSet $other ) : EnumSet
$other EnumSet Other EnumSet(s) of the same enumeration to produce the union
return EnumSet
    public function symDiff(EnumSet $other)
    {
        $bitset = '';
        foreach (func_get_args() as $other) {
            if (!$other instanceof self || $this->enumeration !== $other->enumeration) {
                throw new InvalidArgumentException(sprintf("Others should be an instance of %s of the same enumeration as this %s", __CLASS__, $this->enumeration));
            }
            $bitset |= $other->bitset;
        }
        $clone = clone $this;
        $clone->bitset = $this->bitset ^ $bitset;
        return $clone;
    }