$value]); if ($value === 0) { return new Bill; } /** @var BillRepositoryInterface $repository */ $repository = app(BillRepositoryInterface::class, [$this->user]); if (isset($this->mapping[$value])) { Log::debug('Found bill in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]); $bill = $repository->find(intval($this->mapping[$value])); if (!is_null($bill->id)) { Log::debug('Found bill by ID', ['id' => $bill->id]); return $bill; } } // not mapped? Still try to find it first: $bill = $repository->find($value); if (!is_null($bill->id)) { Log::debug('Found bill by ID ', ['id' => $bill->id]); return $bill; } // should not really happen. If the ID does not match FF, what is FF supposed to do? return new Bill; } }