Copied!

ProductAvailabilityCreateStruct

ProductAvailabilityCreateStruct.php : 14
Extends ValueObject

The base class for all value objects and structs.

Supports readonly properties by marking them as protected. In this case they will only be writable using constructor, and need to be documented using property-read <$var> annotation in class doc in addition to inline property doc. Writable properties must be public and must be documented inline.

Methods

public__construct()

ProductAvailabilityCreateStruct.php : 24

Construct object optionally with a set of properties.

public __construct(ProductInterface $product[, bool $availability = false ][, bool $isInfinite = false ][, int|null $stock = null ])

Readonly properties values must be set using $properties as they are not writable anymore after object has been created.

Parameters

Name Type Default value Description
$product ProductInterface - -
$availability bool false -
$isInfinite bool false -
$stock int|null null -

publiccreateInfinite()

ProductAvailabilityCreateStruct.php : 68
public static createInfinite(ProductInterface $product, bool $available) : self

Parameters

Name Type Default value Description
$product ProductInterface - -
$available bool - -

Return values

self

publiccreateWithStock()

ProductAvailabilityCreateStruct.php : 63
public static createWithStock(ProductInterface $product, bool $available, int $stock) : self

Parameters

Name Type Default value Description
$product ProductInterface - -
$available bool - -
$stock int - -

Return values

self

publicgetAvailability()

ProductAvailabilityCreateStruct.php : 43
public getAvailability() : bool

Return values

bool

publicgetProduct()

ProductAvailabilityCreateStruct.php : 38
public getProduct() : ProductInterface

Return values

ProductInterface

publicgetStock()

ProductAvailabilityCreateStruct.php : 53
public getStock() : int|null

Return values

int|null

publicisInfinite()

ProductAvailabilityCreateStruct.php : 58
public isInfinite() : bool

Return values

bool

publicsetAvailability()

ProductAvailabilityCreateStruct.php : 48
public setAvailability(bool $availability) : void

Parameters

Name Type Default value Description
$availability bool - -

protectedgetProperties()

ValueObject.php : 50

Function where list of properties are returned.

protected getProperties([array<string|int, mixed> $dynamicProperties = [] ]) : array<string|int, mixed>

Used by attributes(), override to add dynamic properties

Parameters

Name Type Default value Description
$dynamicProperties array<string|int, mixed> []

Additional dynamic properties exposed on the object

Return values

array<string|int, mixed>