public function filterType(string
$type): LineItemCollection
{ return $this->
filter( fn (LineItem
$lineItem) =>
$lineItem->
getType() ===
$type );
} public function hasLineItemWithState(string
$state): bool
{ foreach ($this->
buildFlat($this) as $lineItem) { if (\
in_array($state,
$lineItem->
getStates(), true
)) { return true;
} } return false;
} /**
* @return array<array<string, mixed>>
*/