103 lines
2.3 KiB
PHP
103 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Ramcar;
|
|
|
|
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
|
|
|
use DateTime;
|
|
|
|
class HubCriteria
|
|
{
|
|
protected $point; // coordinates of source
|
|
protected $limit_results; // number of results to return
|
|
protected $limit_distance; // distance limit for search in km
|
|
protected $flag_inventory_check; // flag if we need to check for inventory
|
|
protected $jo_type; // jo service needed
|
|
protected $date_time; // date and time to check if hub is open or not
|
|
protected $items; // array of items: items[sku] = quantity to check for
|
|
|
|
public function __construct()
|
|
{
|
|
$this->has_inventory = false;
|
|
$this->items = [];
|
|
}
|
|
|
|
public function setPoint(Point $point)
|
|
{
|
|
$this->point = $point;
|
|
return $this;
|
|
}
|
|
|
|
public function getPoint()
|
|
{
|
|
return $this->point;
|
|
}
|
|
|
|
public function setLimitResults($limit_results)
|
|
{
|
|
$this->limit_results = $limit_results;
|
|
return $this;
|
|
}
|
|
|
|
public function getLimitResults()
|
|
{
|
|
return $this->limit_results;
|
|
}
|
|
|
|
public function setLimitDistance($limit_distance)
|
|
{
|
|
$this->limit_distance = $limit_distance;
|
|
return $this;
|
|
}
|
|
|
|
public function getLimitDistance()
|
|
{
|
|
return $this->limit_distance;
|
|
}
|
|
|
|
public function setInventoryCheck($flag_inventory_check = true)
|
|
{
|
|
$this->flag_inventory_check = $flag_inventory_check;
|
|
return $this;
|
|
}
|
|
|
|
public function hasInventoryCheck()
|
|
{
|
|
return $this->flag_inventory_check;
|
|
}
|
|
|
|
public function setJoType($jo_type)
|
|
{
|
|
// TODO: validate the jo type
|
|
$this->jo_type = $jo_type;
|
|
return $this;
|
|
}
|
|
|
|
public function getJoType()
|
|
{
|
|
return $this->jo_type;
|
|
}
|
|
|
|
public function setDateTime(DateTime $date_time)
|
|
{
|
|
$this->date_time = $date_time;
|
|
return $this;
|
|
}
|
|
|
|
public function getDateTime()
|
|
{
|
|
return $this->date_time;
|
|
}
|
|
|
|
public function addItem($sku, $quantity)
|
|
{
|
|
// at this point, sku is assumed to be a valid item
|
|
$this->items[$sku] = $quantity;
|
|
return $this;
|
|
}
|
|
|
|
public function getItems()
|
|
{
|
|
return $this->items;
|
|
}
|
|
}
|