Code Duplication    Length = 10-10 lines in 4 locations

src/Collection/AbstractCollection.php 4 locations

@@ 88-97 (lines=10) @@
85
     * @param int|string|null $offset
86
     * @param mixed           $value
87
     */
88
    public function offsetSet($offset, $value)
89
    {
90
        if ($this->checkType($this->collectionType, $value) === false) {
91
            throw new \InvalidArgumentException(
92
                'Value must be of type ' . $this->collectionType . '; value is ' . $this->valueToString($value)
93
            );
94
        }
95
96
        parent::offsetSet($offset, $value);
97
    }
98
99
    /**
100
     * Prepend a (key) + value to the current array.
@@ 108-117 (lines=10) @@
105
     * @return static
106
     *                <p>(Mutable) Return this Arrayy object, with the prepended value.</p>
107
     */
108
    public function prepend($value, $key = null): Arrayy
109
    {
110
        if ($this->checkType($this->collectionType, $value) === false) {
111
            throw new \InvalidArgumentException(
112
                'Value must be of type ' . $this->collectionType . '; value is ' . $this->valueToString($value)
113
            );
114
        }
115
116
        return parent::prepend($value, $key);
117
    }
118
119
    /**
120
     * Append a (key) + value to the current array.
@@ 128-137 (lines=10) @@
125
     * @return static
126
     *                <p>(Mutable) Return this Arrayy object, with the appended values.</p>
127
     */
128
    public function append($value, $key = null): Arrayy
129
    {
130
        if ($this->checkType($this->collectionType, $value) === false) {
131
            throw new \InvalidArgumentException(
132
                'Value must be of type ' . $this->collectionType . '; value is ' . $this->valueToString($value)
133
            );
134
        }
135
136
        return parent::append($value, $key);
137
    }
138
139
    /**
140
     * Returns the values from given property or method.
@@ 193-202 (lines=10) @@
190
     *
191
     * @return bool
192
     */
193
    protected function internalSet($key, $value, $checkProperties = true): bool
194
    {
195
        if ($this->checkType($this->collectionType, $value) === false) {
196
            throw new \InvalidArgumentException(
197
                'Value must be of type ' . $this->collectionType . '; value is ' . $this->valueToString($value)
198
            );
199
        }
200
201
        return parent::internalSet($key, $value, $checkProperties);
202
    }
203
204
    /**
205
     * Extracts the value of the given property or method from the object.