data as $key => $value) { if ($this->isSuccessful() && preg_match('/(L_)?(?[A-Za-z]+)(?[0-9]+)/', $key, $matches) ) { $payments[$matches['n']][$matches['key']] = $value; unset($this->data[$key]); } } $this->data['payments'] = $payments; } public function getPayments() { return $this->data['payments']; } }