Code Duplication    Length = 19-19 lines in 2 locations

src/Set.php 2 locations

@@ 54-72 (lines=19) @@
51
        return $copy;
52
    }
53
54
    public function withValueAfter($value, $search)
55
    {
56
        if ($this->hasValue($value)) {
57
            return $this;
58
        }
59
60
        $this->assertValid([$value]);
61
62
        $copy = clone $this;
63
64
        $key = array_search($search, $this->values);
65
        if ($key === false) {
66
            array_push($copy->values, $value);
67
        } else {
68
            array_splice($copy->values, $key + 1, 0, $value);
69
        }
70
71
        return $copy;
72
    }
73
74
    public function withValueBefore($value, $search)
75
    {
@@ 74-92 (lines=19) @@
71
        return $copy;
72
    }
73
74
    public function withValueBefore($value, $search)
75
    {
76
        if ($this->hasValue($value)) {
77
            return $this;
78
        }
79
80
        $this->assertValid([$value]);
81
82
        $copy = clone $this;
83
84
        $key = array_search($search, $this->values);
85
        if ($key === false) {
86
            array_unshift($copy->values, $value);
87
        } else {
88
            array_splice($copy->values, $key, 0, $value);
89
        }
90
91
        return $copy;
92
    }
93
94
    protected function assertValid(array $values)
95
    {