payloadKeyNotFound example

return $this->payload;
    }

    /** * @throws CartException * * @return string|array<mixed> */
    public function getPayloadValue(string $key): string|array
    {
        if (!$this->hasPayloadValue($key)) {
            throw CartException::payloadKeyNotFound($key(string) $this->getCode());
        }

        return $this->payload[$key];
    }

    public function hasPayloadValue(string $key): bool
    {
        return isset($this->payload[$key]);
    }

    /** * Gets the code of the discount if existing. */
public function hasPayloadValue(string $key): bool
    {
        return isset($this->payload[$key]);
    }

    /** * @throws CartException */
    public function removePayloadValue(string $key): void
    {
        if (!$this->hasPayloadValue($key)) {
            throw CartException::payloadKeyNotFound($key$this->getId());
        }
        unset($this->payload[$key]);
        unset($this->payloadProtection[$key]);
    }

    /** * @deprecated tag:v6.6.0 - reason:new-optional-parameter - Parameter $protected will be added in v6.6.0 * * @param mixed|null $value * * @throws CartException */
Home | Imprint | This part of the site doesn't use cookies.