Code Duplication    Length = 11-12 lines in 2 locations

src/Set/Converter/BitMaskConverter.php 1 location

@@ 37-48 (lines=12) @@
34
     * @param int $values
35
     * @return ISet
36
     */
37
    public function convertToEnumSet($values)
38
    {
39
        $bitValue = (int) $values;
40
41
        $set = [];
42
        foreach ($this->mapping as $value => $bit) {
43
            if ($bitValue & $bit) {
44
                $set[] = call_user_func([$this->enumClass, 'instance'], $value);
45
            }
46
        }
47
        return new ImmutableSet($this->enumClass, $set);
48
    }
49
50
    /**
51
     * @param ISet $enumSet

src/Set/Converter/StringSerializeConverter.php 1 location

@@ 33-43 (lines=11) @@
30
     * @param string $serialized
31
     * @return ImmutableSet
32
     */
33
    public function convertToEnumSet($serialized)
34
    {
35
        $serialized = (string) $serialized;
36
        $stringList = unserialize($serialized);
37
38
        $set = [];
39
        foreach ($stringList as $value) {
40
            $set[] = call_user_func([$this->enumClass, 'instance'], $value);
41
        }
42
        return new ImmutableSet($this->enumClass, $set);
43
    }
44
45
    /**
46
     * @param ISet $enumSet