public static function convertToPingppObject($resp, $opts)
{
$types = array('red_envelope' => 'Pingpp\\RedEnvelope', 'charge' => 'Pingpp\\Charge', 'list' => 'Pingpp\\Collection', 'refund' => 'Pingpp\\Refund', 'event' => 'Pingpp\\Event', 'transfer' => 'Pingpp\\Transfer', 'customer' => 'Pingpp\\Customer', 'card' => 'Pingpp\\Card', 'sms_code' => 'Pingpp\\SmsCode', 'card_info' => 'Pingpp\\CardInfo', 'token' => 'Pingpp\\Token');
if (self::isList($resp)) {
$mapped = array();
foreach ($resp as $i) {
array_push($mapped, self::convertToPingppObject($i, $opts));
}
return $mapped;
} else {
if (is_object($resp)) {
if (isset($resp->object) && is_string($resp->object) && isset($types[$resp->object])) {
$class = $types[$resp->object];
} else {
$class = 'Pingpp\\PingppObject';
}
return $class::constructFrom($resp, $opts);
} else {
return $resp;
}
}
}