# Filling in the card expiry date from transaction data

I'm integrating my app with a payment gateway, and have the following code which returns an array to populate the transaction info:

function populate_transaction_info($data) { extract($this->extract_model_data($data)); // set to empty array to ensure run-able code$transaction_info = [];

return array_merge($transaction_info, [ 'pan' =>$card_data['card_number'],
'expdate' => $this->build_expiry_date_string($card_data['card_exp']),
'cust_id' => $person['email'], // ... more params here, not relevant for question ]); } // shown for context / run-ability function extract_model_data($data)
{
return [
'person' => $data['Person'], 'card_data' =>$data['CreditCard']],
];
}



My question pertains to the build_expiry_date_string(), defined as:

function build_expiry_date_string($card_expiry) { return$card_expiry['month'] . substr($card_expiry['year'], -2); }  I'm passing $card_data['card_exp'] into the function, but I'm wondering if the function itself should be the only thing that knows that it needs to look in the card_exp index of the array? So for example, should I refactor as:

...
'expdate' => $this->build_expiry_date_string($card_data),
...