ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 {
25 if($current->getExpirationAsTimestamp() >= $geo_location->getExpirationAsTimestamp()) {
26 $current = $geo_location;
27 }
28 }
29
30 return $geo_location;
31 }

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: