Skip to content

Commit

Permalink
[zendframework#2061] Add imports
Browse files Browse the repository at this point in the history
- import Iterator and IteratorAggregate
  • Loading branch information
weierophinney committed Jul 31, 2012
1 parent 30b150c commit 8957727
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions library/Zend/Json/Encoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace Zend\Json;

use Iterator;
use IteratorAggregate;
use Zend\Json\Exception\InvalidArgumentException;
use Zend\Json\Exception\RecursionException;

Expand Down Expand Up @@ -131,9 +133,9 @@ protected function _encodeObject(&$value)
if (method_exists($value, 'toJson')) {
$props =',' . preg_replace("/^\{(.*)\}$/","\\1",$value->toJson());
} else {
if ($value instanceof \IteratorAggregate) {
if ($value instanceof IteratorAggregate) {
$propCollection = $value->getIterator();
} elseif ($value instanceof \Iterator) {
} elseif ($value instanceof Iterator) {
$propCollection = $value;
} else {
$propCollection = get_object_vars($value);
Expand Down

0 comments on commit 8957727

Please sign in to comment.