\AdamRocska\ShippingTier\Entity\RuntimeTier

Represents a set of shipping method branches sorted in the same tier / category.

Summary

Methods
Properties
Constants
__construct()
getIdentifier()
getLabel()
getFastestShippingMethodBranchForCountry()
addShippingMethodBranch()
setShippingMethodBranches()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
isCurrentTimeFasterThanBest()
assertHasShippingMethodBranches()
$identifier
$label
$shippingMethodBranches
N/A

Properties

$identifier

$identifier : string

The machine identifier of the tier.

Type

string

$label

$label : string

The human comprehensible label of the tier.

Type

string

Methods

__construct()

__construct(string  $identifier, string  $label) 

Tier constructor.

Parameters

string $identifier

The machine identifier of the tier.

string $label

The human comprehensible label of the tier.

getIdentifier()

getIdentifier() : string

Returns the machine identifier of the tier.

Returns

string

getLabel()

getLabel() : string

Returns the human comprehensible label of the tier.

Returns

string

getFastestShippingMethodBranchForCountry()

getFastestShippingMethodBranchForCountry(\AdamRocska\ShippingTier\Entity\Country  $country) : \AdamRocska\ShippingTier\Entity\ShippingMethodBranch

Returns the fastest shipping method branch within the tier, that contains the provided country.

Parameters

\AdamRocska\ShippingTier\Entity\Country $country

Throws

\AdamRocska\ShippingTier\Entity\Tier\Exception\NoShippingMethodBranchesBound

Throws a NoShippingMethodBranchesBound exception when there are no shipping method branches bound to the tier at all.

\AdamRocska\ShippingTier\Entity\Tier\Exception\NoShippingMethodBranchForCountry

Throws a NoShippingMethodBranchForCountry exception when there is no shipping method branch found for the provided country.

Returns

\AdamRocska\ShippingTier\Entity\ShippingMethodBranch

setShippingMethodBranches()

setShippingMethodBranches(\AdamRocska\ShippingTier\Entity\Runtime\iterable  $branches) 

Sets the provided shipping method branches.

It overrides the existing set of shipping methods bound to this instance.

Parameters

\AdamRocska\ShippingTier\Entity\Runtime\iterable $branches

isCurrentTimeFasterThanBest()

isCurrentTimeFasterThanBest(\AdamRocska\ShippingTier\Entity\DoorToDoorTransitTime  $current, \AdamRocska\ShippingTier\Entity\DoorToDoorTransitTime  $best) : boolean

Compares the received `DoorToDoorTransitTime` against the received "best" / fastest `DoorToDoorTransitTime`, and tells whether the new one is considered to be faster, than the current best.

The decision logic finds the one, that's most likely to arrive sooner.

Parameters

\AdamRocska\ShippingTier\Entity\DoorToDoorTransitTime $current

The DoorToDoorTransitTime of a competing shipping method branch.

\AdamRocska\ShippingTier\Entity\DoorToDoorTransitTime $best

The DoorToDoorTransitTime of the shipping method branch considered as the fastest at the time of comparison.

Returns

boolean

assertHasShippingMethodBranches()

assertHasShippingMethodBranches() 

Asserts, that the current tier object has shipping method branches bound.

Throws

\AdamRocska\ShippingTier\Entity\Tier\Exception\NoShippingMethodBranchesBound