/** * @param SKU $sku * * @return Product * * @throws ProductNotFoundException */ public function getBySku(SKU $sku) : Product { if (!array_key_exists((string) $sku, $this->products)) { throw ProductNotFoundException::bySku($sku); } return $this->products[(string) $sku]; }