Code Duplication    Length = 10-10 lines in 2 locations

src/Set/ImmutableSet.php 2 locations

@@ 15-24 (lines=10) @@
12
     * @param Enum $enum
13
     * @return self
14
     */
15
    public function add(Enum $enum)
16
    {
17
        if (!($enum instanceof $this->enumClass)) {
18
            throw new EnumSetMustContainEnumsException(sprintf("Expected %s, got %s", $this->enumClass, get_class($enum)));
19
        }
20
        $set = $this->set;
21
        $set[(string) $enum] = $enum;
22
23
        return new ImmutableSet($this->enumClass, $set);
24
    }
25
26
    /**
27
     * @param Enum $enum
@@ 30-39 (lines=10) @@
27
     * @param Enum $enum
28
     * @return self
29
     */
30
    public function remove(Enum $enum)
31
    {
32
        if (!($enum instanceof $this->enumClass)) {
33
            throw new EnumSetMustContainEnumsException(sprintf("Expected %s, got %s", $this->enumClass, get_class($enum)));
34
        }
35
        $set = $this->set;
36
        unset($set[(string) $enum]);
37
38
        return new ImmutableSet($this->enumClass, $set);
39
    }
40
}
41