ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilGeoLocationCalculator Class Reference
+ Collaboration diagram for ilGeoLocationCalculator:

Public Member Functions

 __construct (ilGeoLocationRepository $a_geo_repository)
 
 calculateTimeTillNextExpiredGeoLocationAt (float $latitude, float $longitude)
 

Protected Attributes

 $geo_repository
 

Detailed Description

Definition at line 3 of file ilGeoLocationCalculator.php.

Constructor & Destructor Documentation

◆ __construct()

ilGeoLocationCalculator::__construct ( ilGeoLocationRepository  $a_geo_repository)

Definition at line 8 of file ilGeoLocationCalculator.php.

9  {
10  $this->geo_repository = $a_geo_repository;
11  }

Member Function Documentation

◆ calculateTimeTillNextExpiredGeoLocationAt()

ilGeoLocationCalculator::calculateTimeTillNextExpiredGeoLocationAt ( float  $latitude,
float  $longitude 
)

Definition at line 13 of file ilGeoLocationCalculator.php.

14  {
15  $geo_locations = $this->geo_repository->getGeoLocationsByCoordinates($latitude, $longitude);
16 
17  if (count($geo_locations) === 0) {
18  return null;
19  }
20 
21  $current = array_shift($geo_locations);
22 
23  foreach ($geo_locations as $geo_location) {
24  if ($current->getExpirationAsTimestamp() >= $geo_location->getExpirationAsTimestamp()) {
25  $current = $geo_location;
26  }
27  }
28 
29  return $geo_location;
30  }

Field Documentation

◆ $geo_repository

ilGeoLocationCalculator::$geo_repository
protected

Definition at line 6 of file ilGeoLocationCalculator.php.


The documentation for this class was generated from the following file: