public function createHeader(): string
    {
        $header = [rawurlencode($this->name) . '=' . rawurlencode((string)$this->value)];

        if ($this->lifetime !== null) {
            $header[] = 'Expires=' . gmdate(\DateTime::COOKIE, $this->getExpires());
            $header[] = 'Max-Age=' . $this->lifetime;
        }

        if (!empty($this->path)) {
            $header[] = 'Path=' . $this->path;
        }

        if (!empty($this->domain)) {
            $header[] = 'Domain=' . $this->domain;
        }

        if ($this->secure) {
            $header[] = 'Secure';
        }

        if ($this->httpOnly) {
            $header[] = 'HttpOnly';
        }

        return join('; ', $header);
    }
public function createHeader(): string
    {
        $header = [rawurlencode($this->name) . '=' . rawurlencode((string)$this->value)];

        if ($this->lifetime !== null) {
            $header[] = 'Expires=' . gmdate(\DateTime::COOKIE, $this->getExpires());
            $header[] = 'Max-Age=' . $this->lifetime;
        }

        if (!empty($this->path)) {
            $header[] = 'Path=' . $this->path;
        }

        if (!empty($this->domain)) {
            $header[] = 'Domain=' . $this->domain;
        }

        if ($this->secure) {
            $header[] = 'Secure';
        }

        if ($this->httpOnly) {
            $header[] = 'HttpOnly';
        }

        return join('; ', $header);
    }
public function createHeader ( ) : string { $ header = [ rawurlencode ( $ this -> name ) . '=' . rawurlencode ( ( string ) $ this -> value ) ] ; if ( $ this -> lifetime !== null ) { $ header [ ] = 'Expires=' . gmdate ( \ DateTime :: COOKIE , $ this -> getExpires ( ) ) ; $ header [ ] = 'Max-Age=' . $ this -> lifetime ; } if ( ! empty ( $ this -> path ) ) { $ header [ ] = 'Path=' . $ this -> path ; } if ( ! empty ( $ this -> domain ) ) { $ header [ ] = 'Domain=' . $ this -> domain ; } if ( $ this -> secure ) { $ header [ ] = 'Secure' ; } if ( $ this -> httpOnly ) { $ header [ ] = 'HttpOnly' ; } return join ( '; ' , $ header ) ; }
Convert cookie instance to string.

@link http://www.w3.org/Protocols/rfc2109/rfc2109
@return string
Convert cookie instance to string .