public static byId ( |
||
$cartId | ||
return |
public static function byId(CartId $cartId) : CartNotFoundException
{
return new self(sprintf('Cart with id "%s" does not exists.', (string) $cartId));
}
/** * @param CartId $cartId * * @throws CartNotFoundException */ public function remove(CartId $cartId) { if (!$this->exists($cartId)) { throw CartNotFoundException::byId($cartId); } unset($this->carts[(string) $cartId]); }