. */ declare(strict_types=1); namespace FireflyIII\Support\Http\Api; use FireflyIII\Models\Account; use Illuminate\Support\Collection; /** * Trait ApiSupport */ trait ApiSupport { /** * Small helper function for the revenue and expense account charts. */ protected function expandNames(array $names): array { $result = []; foreach ($names as $entry) { $result[$entry['name']] = 0; } return $result; } /** * Small helper function for the revenue and expense account charts. */ protected function extractNames(Collection $accounts): array { $return = []; /** @var Account $account */ foreach ($accounts as $account) { $return[$account->id] = $account->name; } return $return; } }