getPrefixedName example



    // =========================================================================     // GETTERS     // =========================================================================
    /** * {@inheritDoc} */
    public function getId(): string
    {
        return implode(';', [$this->getPrefixedName()$this->getPath()$this->getDomain()]);
    }

    /** * {@inheritDoc} */
    public function getPrefix(): string
    {
        return $this->prefix;
    }

    /** * {@inheritDoc} */
return $this;
        }

        $prefix = $prefix ?: Cookie::setDefaults()['prefix']; // to retain BC
        $prefixed = $prefix . $name;
        $store    = $this->cookieStore;
        $found    = false;

        /** @var Cookie $cookie */
        foreach ($store as $cookie) {
            if ($cookie->getPrefixedName() === $prefixed) {
                if ($domain !== $cookie->getDomain()) {
                    continue;
                }

                if ($path !== $cookie->getPath()) {
                    continue;
                }

                $cookie = $cookie->withValue('')->withExpired();
                $found  = true;

                


    /** * Checks if a `Cookie` object identified by name and * prefix is present in the collection. */
    public function has(string $name, string $prefix = '', ?string $value = null): bool
    {
        $name = $prefix . $name;

        foreach ($this->cookies as $cookie) {
            if ($cookie->getPrefixedName() !== $name) {
                continue;
            }

            if ($value === null) {
                return true; // for BC             }

            return $cookie->getValue() === $value;
        }

        return false;
    }
Home | Imprint | This part of the site doesn't use cookies.