public static function parseResponseToPatrolObject(Patrol $patrol, $data, $class = null, $defaults = null) {
        if (self::isIterator($data)) {
            $parsed = [];
            foreach ($data as $item) {
                $parsed[] = self::parseResponseToPatrolObject($patrol, $item, $class, $defaults);
            }
            return $parsed;
        } else if (self::isObject($data)) {
            $callable_class = is_null($class) ? 'PatrolSdk\PatrolObject' : $class;
            return new $callable_class($patrol, $data, $defaults);
        } else {
            return $data;
        }
    }
public static function parseResponseToPatrolObject(Patrol $patrol, $data, $class = null, $defaults = null) {
        if (self::isIterator($data)) {
            $parsed = [];
            foreach ($data as $item) {
                $parsed[] = self::parseResponseToPatrolObject($patrol, $item, $class, $defaults);
            }
            return $parsed;
        } else if (self::isObject($data)) {
            $callable_class = is_null($class) ? 'PatrolSdk\PatrolObject' : $class;
            return new $callable_class($patrol, $data, $defaults);
        } else {
            return $data;
        }
    }
public static function parseResponseToPatrolObject ( Patrol $ patrol , $ data , $ class = null , $ defaults = null ) { if ( self :: isIterator ( $ data ) ) { $ parsed = [ ] ; foreach ( $ data as $ item ) { $ parsed [ ] = self :: parseResponseToPatrolObject ( $ patrol , $ item , $ class , $ defaults ) ; } return $ parsed ; } else if ( self :: isObject ( $ data ) ) { $ callable_class = is_null ( $ class ) ? 'PatrolSdk\PatrolObject' : $ class ; return new $ callable_class ( $ patrol , $ data , $ defaults ) ; } else { return $ data ; } }
Parses a response to PatrolModel

@param Patrol $patrol
@param object $data
@param string $class
@param array $defaults

@return object Can be an array (if response is a collection), a PatrolModel object or the default data (if primitive data type)
Parses a response to PatrolModel