Code Duplication    Length = 10-10 lines in 4 locations

src/Collection/AbstractCollection.php 4 locations

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