public function createAppropriateIterator(Response $response)
    {
        $this->checkResponseFormat($response);

        set_error_handler(function() { /* ignore errors */ });
        $arr = json_decode($response->getBody(), true, 512, 1);
        restore_error_handler();

        $objects = [];
        foreach ($arr['objects'] as $object) {
            if (isset($this->apiEntities[$object['type']])) {
                $class = $this->apiEntities[$object['type']];
            } else {
                $class = $this->apiEntities['*'];
            }
            $objects[] = new $class($object);
        }

        return new EntityIterator($objects, $response);
    }
public function createAppropriateIterator(Response $response)
    {
        $this->checkResponseFormat($response);

        set_error_handler(function() { /* ignore errors */ });
        $arr = json_decode($response->getBody(), true, 512, 1);
        restore_error_handler();

        $objects = [];
        foreach ($arr['objects'] as $object) {
            if (isset($this->apiEntities[$object['type']])) {
                $class = $this->apiEntities[$object['type']];
            } else {
                $class = $this->apiEntities['*'];
            }
            $objects[] = new $class($object);
        }

        return new EntityIterator($objects, $response);
    }
public function createAppropriateIterator ( Response $ response ) { $ this -> checkResponseFormat ( $ response ) ; set_error_handler ( function ( ) { /* ignore errors */ } ) ; $ arr = json_decode ( $ response -> getBody ( ) , true , 512 , 1 ) ; restore_error_handler ( ) ; $ objects = [ ] ; foreach ( $ arr [ 'objects' ] as $ object ) { if ( isset ( $ this -> apiEntities [ $ object [ 'type' ] ] ) ) { $ class = $ this -> apiEntities [ $ object [ 'type' ] ] ; } else { $ class = $ this -> apiEntities [ '*' ] ; } $ objects [ ] = new $ class ( $ object ) ; } return new EntityIterator ( $ objects , $ response ) ; }
Creates an appropriate Entity from a given Response
If no valid Entity can be found for typo of API, the Wildcard entity is selected

@todo: remove error avoidance when issue 12 is fixed: https://github.com/Swader/diffbot-php-client/issues/12
@param Response $response
@return EntityIterator
@throws DiffbotException
Creates an appropriate Entity from a given Response If no valid Entity can be found for typo of API the Wildcard entity is selected