Code Duplication    Length = 10-10 lines in 4 locations

src/Collection/AbstractCollection.php 4 locations

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