public function fromSetCookieHeader(string $header, string $issuingDomain): void
    {
        list($this->name, $header) = explode('=', $header, 2);
        if (false === strpos($header, ';')) {
            $this->value = $header;
            $header = null;
        } else {
            list($this->value, $header) = explode(';', $header, 2);
        }

        $this->clearAttributes();
        if (null !== $header) {
            foreach (array_map('trim', explode(';', trim($header))) as $pair) {
                if (false === strpos($pair, '=')) {
                    $name = $pair;
                    $value = null;
                } else {
                    list($name, $value) = explode('=', $pair);
                }

                $this->setAttribute($name, $value);
            }
        }

        if (!$this->getAttribute(static::ATTR_DOMAIN)) {
            $this->setAttribute(static::ATTR_DOMAIN, $issuingDomain);
        }
    }
public function fromSetCookieHeader(string $header, string $issuingDomain): void
    {
        list($this->name, $header) = explode('=', $header, 2);
        if (false === strpos($header, ';')) {
            $this->value = $header;
            $header = null;
        } else {
            list($this->value, $header) = explode(';', $header, 2);
        }

        $this->clearAttributes();
        if (null !== $header) {
            foreach (array_map('trim', explode(';', trim($header))) as $pair) {
                if (false === strpos($pair, '=')) {
                    $name = $pair;
                    $value = null;
                } else {
                    list($name, $value) = explode('=', $pair);
                }

                $this->setAttribute($name, $value);
            }
        }

        if (!$this->getAttribute(static::ATTR_DOMAIN)) {
            $this->setAttribute(static::ATTR_DOMAIN, $issuingDomain);
        }
    }
public function fromSetCookieHeader ( string $ header , string $ issuingDomain ) : void { list ( $ this -> name , $ header ) = explode ( '=' , $ header , 2 ) ; if ( false === strpos ( $ header , ';' ) ) { $ this -> value = $ header ; $ header = null ; } else { list ( $ this -> value , $ header ) = explode ( ';' , $ header , 2 ) ; } $ this -> clearAttributes ( ) ; if ( null !== $ header ) { foreach ( array_map ( 'trim' , explode ( ';' , trim ( $ header ) ) ) as $ pair ) { if ( false === strpos ( $ pair , '=' ) ) { $ name = $ pair ; $ value = null ; } else { list ( $ name , $ value ) = explode ( '=' , $ pair ) ; } $ this -> setAttribute ( $ name , $ value ) ; } } if ( ! $ this -> getAttribute ( static :: ATTR_DOMAIN ) ) { $ this -> setAttribute ( static :: ATTR_DOMAIN , $ issuingDomain ) ; } }
Populates the current cookie with data from the supplied Set-Cookie header.

@param string $header        A Set-Cookie header
@param string $issuingDomain The domain that issued the header
Populates the current cookie with data from the supplied Set - Cookie header .