Code Duplication    Length = 10-15 lines in 2 locations

src/Collection.php 2 locations

@@ 118-127 (lines=10) @@
115
     *
116
     * @return int
117
     */
118
    public function key()
119
    {
120
        if ($this->position === -1) {
121
            $this->next();
122
        }
123
124
        Util::ensure(false, empty($this->result), '\OutOfBoundsException', ['Collection contains no elements']);
125
126
        return $this->offset + $this->position;
127
    }
128
129
    /**
130
     * @see Iterator::valid()
@@ 175-189 (lines=15) @@
172
     *
173
     * @return array
174
     */
175
    public function current()
176
    {
177
        if ($this->position === -1) {
178
            $this->next();
179
        }
180
181
        Util::ensure(
182
            true,
183
            array_key_exists($this->position, $this->result),
184
            '\OutOfBoundsException',
185
            ['Collection contains no element at current position']
186
        );
187
188
        return $this->result[$this->position];
189
    }
190
191
    /**
192
     * Returns the values from a single field this collection, identified by the given $key.