Code Duplication    Length = 10-10 lines in 4 locations

src/Collection/AbstractCollection.php 4 locations

@@ 81-90 (lines=10) @@
78
     * @param int|string|null $offset
79
     * @param mixed           $value
80
     */
81
    public function offsetSet($offset, $value)
82
    {
83
        if ($this->checkType($this->getType(), $value) === false) {
84
            throw new \InvalidArgumentException(
85
                'Value must be of type ' . $this->getType() . '; value is ' . $this->valueToString($value)
86
            );
87
        }
88
89
        parent::offsetSet($offset, $value);
90
    }
91
92
    /**
93
     * Prepend a (key) + value to the current array.
@@ 101-110 (lines=10) @@
98
     * @return static
99
     *                <p>(Mutable) Return this Arrayy object, with the prepended value.</p>
100
     */
101
    public function prepend($value, $key = null): Arrayy
102
    {
103
        if ($this->checkType($this->getType(), $value) === false) {
104
            throw new \InvalidArgumentException(
105
                'Value must be of type ' . $this->getType() . '; value is ' . $this->valueToString($value)
106
            );
107
        }
108
109
        return parent::prepend($value, $key);
110
    }
111
112
    /**
113
     * Append a (key) + value to the current array.
@@ 121-130 (lines=10) @@
118
     * @return static
119
     *                <p>(Mutable) Return this Arrayy object, with the appended values.</p>
120
     */
121
    public function append($value, $key = null): Arrayy
122
    {
123
        if ($this->checkType($this->getType(), $value) === false) {
124
            throw new \InvalidArgumentException(
125
                'Value must be of type ' . $this->getType() . '; value is ' . $this->valueToString($value)
126
            );
127
        }
128
129
        return parent::append($value, $key);
130
    }
131
132
    /**
133
     * Returns the values from given property or method.
@@ 186-195 (lines=10) @@
183
     *
184
     * @return bool
185
     */
186
    protected function internalSet($key, $value, $checkProperties = true): bool
187
    {
188
        if ($this->checkType($this->getType(), $value) === false) {
189
            throw new \InvalidArgumentException(
190
                'Value must be of type ' . $this->getType() . '; value is ' . $this->valueToString($value)
191
            );
192
        }
193
194
        return parent::internalSet($key, $value, $checkProperties);
195
    }
196
197
    /**
198
     * Extracts the value of the given property or method from the object.