/** * @param OfferComponent $component * * @return bool */ public function takeComponent(OfferComponent $component) : bool { // Don't accept if this offer does not apply to the product. if (!$this->appliesToProduct($component->product())) { return false; } // Don't accept if this offer is already fulfilled. if ($this->requirementsAreMet()) { return false; } $this->components->put($component->id(), $component); return true; }