. */ declare(strict_types=1); namespace FireflyIII\Import\Mapper; use FireflyIII\Models\Category; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; /** * Class Categories. */ class Categories implements MapperInterface { /** * @return array */ public function getMap(): array { /** @var CategoryRepositoryInterface $repository */ $repository = app(CategoryRepositoryInterface::class); $result = $repository->getCategories(); $list = []; /** @var Category $category */ foreach ($result as $category) { $categoryId = (int)$category->id; $list[$categoryId] = $category->name; } asort($list); $list = [0 => trans('import.map_do_not_map')] + $list; return $list; } }