InStock
in package
implements
AvailabilityState
FinalYes
“In stock” availability state.
Tags
Table of Contents
Interfaces
- AvailabilityState
- Stock availability status.
Constants
- SCHEMA_IN_STOCK = 'https://schema.org/InStock'
Properties
- $inStockQuantity : QuantityInterface
- $shipmentTime : int
- $ui : AvailabilityUiInterface
Methods
- __construct() : mixed
- State constructor.
- getInStockQuantity() : QuantityInterface|null
- Returns quantity currently in stock.
- getMicrodataSchema() : string|null
- Returns schema.org URI of the availability state.
- getShipmentTime() : int|null
- Returns how many hours it will take to ship out the item.
- getUi() : AvailabilityUiInterface|null
- Returns availability information that can be displayed to the user.
- isAvailable() : bool
- Should the item be available for ordering?
- isInStock() : bool
- Is the item in stock and ready to be shipped (virtually) immediately?
Constants
SCHEMA_IN_STOCK
private
mixed
SCHEMA_IN_STOCK
= 'https://schema.org/InStock'
Properties
$inStockQuantity
private
QuantityInterface
$inStockQuantity
$shipmentTime
private
int
$shipmentTime
$ui
private
AvailabilityUiInterface
$ui
Methods
__construct()
State constructor.
public
__construct(int $shipmentTime, QuantityInterface $inStockQuantity, AvailabilityUiInterface $ui) : mixed
APIYes
Parameters
- $shipmentTime : int
-
time to shipment (in hours)
- $inStockQuantity : QuantityInterface
-
quantity in stock
- $ui : AvailabilityUiInterface
-
user interface
getInStockQuantity()
Returns quantity currently in stock.
public
getInStockQuantity() : QuantityInterface|null
Tags
Return values
QuantityInterface|null —quantity or null
if not applicable
getMicrodataSchema()
Returns schema.org URI of the availability state.
public
getMicrodataSchema() : string|null
Tags
Return values
string|null —schema.org URI or null
if not applicable
getShipmentTime()
Returns how many hours it will take to ship out the item.
public
getShipmentTime() : int|null
Tags
Return values
int|null —number of hours or null
if not applicable or unknown
getUi()
Returns availability information that can be displayed to the user.
public
getUi() : AvailabilityUiInterface|null
Tags
Return values
AvailabilityUiInterface|nullisAvailable()
Should the item be available for ordering?
public
isAvailable() : bool
Tags
Return values
bool —true
if yes, false
if the customer should be forbidden from ordering it
isInStock()
Is the item in stock and ready to be shipped (virtually) immediately?
public
isInStock() : bool
Tags
Return values
bool —true
if yes, false
otherwise