Esempio n. 1
0
    }
    /**
     * @param $shipmentID int
     * @param $latitude double
     * @param $longitude double
     * @param $regionID int
     * @param $requestedDateTime DateTime
     */
    public function __construct($shipmentID, $latitude, $longitude, $regionID, $requestedDateTime)
    {
        parent::__construct($latitude, $longitude, $regionID);
        $this->shipmentID = $shipmentID;
        $this->requestedDateTime = $requestedDateTime;
    }
    /**
     * @return mixed
     */
    public function getRequestedDateTime()
    {
        return $this->requestedDateTime;
    }
    /**
     * @return int
     */
    public function getShipmentID()
    {
        return $this->shipmentID;
    }
}
PickupRequest::init();
Esempio n. 2
0
 /**
  * Looks up pickup details in cache.
  *
  * Performance: O(1) time complexity (constant time)
  *
  * @param $shipmentID
  * @return bool|PickupRequest returns false if pickup request doesn't exist in the cache,
  *                              otherwise it returns a PickupRequest model instance containing request details
  */
 public function lookupPickupRequest($shipmentID)
 {
     $shipmentID = intval($shipmentID);
     if (!is_int($shipmentID)) {
         throw new InvalidArgumentException("lookupPickupRequest expects shipment id to be an integer. Input was: {$shipmentID}");
     }
     if (!$this->client->exists(self::pickupRequestPath($shipmentID))) {
         return false;
     }
     //O(1) time complexity
     $values = $this->client->hmget(self::pickupRequestPath($shipmentID), PickupRequest::$PICKUP_REQUEST_ATTRIBUTE_KEYS);
     return PickupRequest::fromValues($shipmentID, $values);
 }