Refactor accessors for client gateway token meta prop

This commit is contained in:
David Bomba 2025-11-26 12:10:30 +11:00
parent ff628ae848
commit d955f0b13d
1 changed files with 10 additions and 10 deletions

View File

@ -49,24 +49,24 @@ class ClientGatewayTokenTransformer extends EntityTransformer
{
$casted = new stdClass();
if (property_exists($meta, 'exp_month')) {
$casted->exp_month = (string) $meta->exp_month;
if ($exp_month = data_get($meta, 'exp_month')) {
$casted->exp_month = (string) $exp_month;
}
if (property_exists($meta, 'exp_year')) {
$casted->exp_year = (string) $meta->exp_year;
if ($exp_year = data_get($meta, 'exp_year')) {
$casted->exp_year = (string) $exp_year;
}
if (property_exists($meta, 'brand')) {
$casted->brand = (string) $meta->brand;
if ($brand = data_get($meta, 'brand')) {
$casted->brand = (string) $brand;
}
if (property_exists($meta, 'last4')) {
$casted->last4 = (string) $meta->last4;
if ($last4 = data_get($meta, 'last4')) {
$casted->last4 = (string) $last4;
}
if (property_exists($meta, 'type')) {
$casted->type = (int) $meta->type;
if ($type = data_get($meta, 'type')) {
$casted->type = (int) $type;
}
return $casted;