<?php require_once 'areaOfInterestUrn.php'; $urns = array('urn:cite:olg:leiden_vlf123_0001.tif' . '@.2,0,.53,.4' . '+@0,0,.1,.001' . '+leiden_vlf123_0002.tif' . '@1,1,0,0', 'urn:cite:olg:leiden_vlf123_0001.tif' . '@1,2,0.53,.4' . '+@0,0,7.1,.001' . '+leiden_vlf123_0002.tif' . '@1,5,1,1', 'urn:cite:olg:leiden_vlf123_0001.tif' . '@@1,0,0.53,.4' . '++@0,0,.1,.001' . '+leiden_vlf123_0002.tif' . '@1,1,1,1', '¬URN'); echo "Testing some URN cases:\n"; foreach ($urns as $k => $urn) { $x = AreaOfInterestUrn::parseUrn($urn); if (is_array($x)) { $x = json_encode($x); } echo "{$urn} =>\n{$x}\n\n"; }
/** @param $stmt mysqli_stmt @return $aois [AreaOfInterest] Helper method for self::getAOI*(). Executes and closes $stmt. */ private static function getAOIsFromStmt($stmt) { $aois = array(); $stmt->execute(); $stmt->bind_result($urn, $timestamp, $userId, $typeEnum, $typeText); while ($stmt->fetch()) { $aoi = new AreaOfInterest(); //Basic attributes: $aoi->type = $typeEnum; $aoi->typeText = $typeText; $aoi->timestamp = $timestamp; $aoi->userId = $userId; $aoi->urn = $urn; //Parsing URN: $aoi->scanRectangleMap = AreaOfInterestUrn::parseUrn($urn); if ($aoi->scanRectangleMap === null) { continue; } //Pushing into return values: array_push($aois, $aoi); } $stmt->close(); return $aois; }