/** * Test for being open on what's normally a day off * E.g. "Mo-Sa 10:00-18:00; Jun 23 11:15-13:30" * * @return void */ public function testOpeningOnSpecificSunday() { $oh = new Services_OpenStreetMap_OpeningHours(); $oh->setValue("Mo-Sa 10:00-18:00; Jun 23 11:15-13:30"); $this->assertFalse($oh->isOpen(strtotime('June 23 2013 11:00'))); $this->assertTrue($oh->isOpen(strtotime('June 23 2013 11:45'))); $this->assertFalse($oh->isOpen(strtotime('June 23 2013 13:35'))); }
} else { die; } } if (isset($_GET['lat'])) { $lat = $_GET['lat']; } if (isset($_GET['lat'])) { $lon = $_GET['lon']; } $osm = new Services_OpenStreetMap(); $osm->loadXML("./map.osm"); $results = $osm->search(array($k => $v)); echo "List of {$k}/{$v}\n"; echo "==================\n\n"; $oh = new Services_OpenStreetMap_OpeningHours(); foreach ($results as $result) { if ($result->getType() == 'node') { $bLat = $result->getLat(); $bLon = $result->getLon(); } elseif ($result->getType() == 'way' && $result->isClosed()) { $nodes = $result->getNodes(); array_pop($nodes); $bLat = 0; $bLon = 0; foreach ($nodes as $node) { $n = $osm->getNode($node); $bLat += $n->getLat(); $bLon += $n->getLon(); } $bLat = $bLat / sizeof($nodes);