Skip to content

Commit

Permalink
Merge pull request #37 from jdreesen/simple-array-iterator
Browse files Browse the repository at this point in the history
Use ArrayIterator instead of RecursiveArrayIterator for array input
  • Loading branch information
DusanKasan committed Apr 24, 2017
2 parents 68f1b8c + 6a99b23 commit cc29a0b
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 cc29a0b

Please sign in to comment.