Stock Availability

InStock implements AvailabilityState

FinalYes

“In stock” availability state.

Tags
author

Jakub Jabůrek jaburek.jakub@gmail.com

subpackage

State

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

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
inheritdoc
Return values
QuantityInterface|null —

quantity or null if not applicable

getMicrodataSchema()

Returns schema.org URI of the availability state.

public getMicrodataSchema() : string|null
Tags
inheritdoc
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
inheritdoc
Return values
int|null —

number of hours or null if not applicable or unknown

isAvailable()

Should the item be available for ordering?

public isAvailable() : bool
Tags
inheritdoc
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
inheritdoc
Return values
bool —

true if yes, false otherwise


        
On this page

Search results