Skip to content

Commit

Permalink
Use ArrayIterator instead of RecursiveArrayIterator for array input
Browse files Browse the repository at this point in the history
  • Loading branch information
jdreesen committed Apr 24, 2017
1 parent 68f1b8c commit 6a99b23
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace DusanKasan\Knapsack;

use ArrayIterator;
use DusanKasan\Knapsack\Exceptions\InvalidArgument;
use DusanKasan\Knapsack\Exceptions\InvalidReturnValue;
use IteratorAggregate;
use RecursiveArrayIterator;
use Traversable;

class Collection implements IteratorAggregate, \Serializable
Expand Down Expand Up @@ -33,7 +33,7 @@ public function __construct($input)
}

if (is_array($input)) {
$this->input = new RecursiveArrayIterator($input);
$this->input = new ArrayIterator($input);
} elseif ($input instanceof Traversable) {
$this->input = $input;
} else {
Expand Down Expand Up @@ -101,7 +101,7 @@ public function getIterator()
$input = call_user_func($this->inputFactory);

if (is_array($input)) {
$input = new RecursiveArrayIterator($input);
$input = new ArrayIterator($input);
}

if (!($input instanceof Traversable)) {
Expand Down

0 comments on commit 6a99b23

Please sign in to comment.