Code Duplication    Length = 9-13 lines in 2 locations

src/JArray/Javascript.php 2 locations

@@ 195-207 (lines=13) @@
192
     * @param int $fromIndex
193
     * @return int|string
194
     */
195
    public function indexOf($searchElement, $fromIndex = 0)
196
    {
197
        $result = array_search($searchElement, $this->getArrayCopy(), true);
198
199
        return $result === false ? -1 : $result + $fromIndex;
200
201
        // if ($fromIndex < 0) {
202
        //     $fromIndex = $this->length() + $fromIndex;
203
        // }
204
        // $result = array_search($searchElement, $this->slice($fromIndex)->getArrayCopy(), true);
205
206
        // return $result === false ? -1 : $result + $fromIndex;
207
    }
208
209
    /**
210
     * The join() method joins all elements of an array into a string.
@@ 237-245 (lines=9) @@
234
     * @param int $fromIndex
235
     * @return int|string
236
     */
237
    public function lastIndexOf($searchElement, $fromIndex = 0)
238
    {
239
        $result = array_search($searchElement, array_reverse($this->getArrayCopy(), true));
240
241
        return $result === false ? -1 : $result;
242
        // $result = array_search($searchElement, array_reverse($this->slice($fromIndex)->getArrayCopy(), true));
243
244
        // return ($result === false) ? -1 : $result + $fromIndex;
245
    }
246
247
    /**
248
     * The map() method creates a new array with the results of calling a provided function on every element in this array.