%PDF- %PDF-
Direktori : /www/old2/_music/diplomka/diplomka/src/cluster/ |
Current File : /www/old2/_music/diplomka/diplomka/src/cluster/PortalList.php |
<?php include_once "Portal.php"; class PortalList { var $portals = array(); public function __construct() { // Nothing yet } public function addPortal(Portal $p) { if(!in_array($p->guid, $this->portals)) { $this->portals[$p->guid] = $p; } } public function getPortals(DateTime $time) { $out = array(); foreach($this->portals as $p) { foreach($p->history as $h) { if($h->start <= $time->modify("-5min") && $h->end >= $time->modify("+5min")) { $out[] = clone $p; break; } } } return $out; } public function getStartTime() { $out = new DateTime("2020-01-01"); foreach($this->portals as $p) { // Can do this because only portals with at least one L7-8 history is stored // and history is sorted by time ascending if($p->history[0]->start < $out) { $out = $p->history[0]->start; } } return $out; } }