. */ declare(strict_types=1); namespace FireflyIII\Support\Request; /** * Trait GetRecurrenceData */ trait GetRecurrenceData { protected function getSingleTransactionData(array $transaction): array { $return = []; $stringKeys = ['id']; $intKeys = ['currency_id', 'foreign_currency_id', 'source_id', 'destination_id', 'bill_id', 'piggy_bank_id', 'bill_id', 'budget_id', 'category_id']; $keys = ['amount', 'currency_code', 'foreign_amount', 'foreign_currency_code', 'description', 'tags']; foreach ($stringKeys as $key) { if (array_key_exists($key, $transaction)) { $return[$key] = (string) $transaction[$key]; } } foreach ($intKeys as $key) { if (array_key_exists($key, $transaction)) { $return[$key] = (int) $transaction[$key]; } } foreach ($keys as $key) { if (array_key_exists($key, $transaction)) { $return[$key] = $transaction[$key]; } } return $return; } }