loginAddressMapper = $loginAddressMapper; $this->loginAddressAggregatedMapper = $loginAddressAggregatedMapper; $this->modelMapper = $modelMapper; } public function getStatistics(): AppStatistics { return new AppStatistics( $this->isActive(), array_merge( $this->modelMapper->findMostRecent(14, Ipv4Strategy::getTypeName()), $this->modelMapper->findMostRecent(14, IpV6Strategy::getTypeName()) ), TrainingDataConfig::default(), $this->getTrainingDataStats() ); } protected function isActive(): bool { try { $this->modelMapper->findLatest(Ipv4Strategy::getTypeName()); return true; } catch (DoesNotExistException $ex) { return false; } } private function getTrainingDataStats(): TrainingDataStatistics { return new TrainingDataStatistics( $this->loginAddressMapper->getCount() + $this->loginAddressAggregatedMapper->getTotalCount(), $this->loginAddressAggregatedMapper->getCount() ); } }