protected function parseCookies(): array
    {
        # cookies are encoded in the `cookie` header
        $header = $this->getHeader("cookie");
        if (empty($header)) {
            return [];
        }

        # create a data collection to gracefully handle arrays
        $options = $this->getDecoderOptions();
        $collection = new \sndsgd\http\data\Collection(
            $options->getMaxVars(),
            $options->getMaxNestingLevels()
        );

        foreach (explode(";", $header) as $cookie) {
            $cookie = trim($cookie);
            if ($cookie === "") {
                continue;
            }

            $pair = explode("=", $cookie, 2);
            if (!isset($pair[1]) || $pair[1] === "") {
                continue;
            }

            list($key, $value) = $pair;
            $collection->addValue(urldecode($key), urldecode($value));
        }

        return $collection->getValues();
    }
protected function parseCookies(): array
    {
        # cookies are encoded in the `cookie` header
        $header = $this->getHeader("cookie");
        if (empty($header)) {
            return [];
        }

        # create a data collection to gracefully handle arrays
        $options = $this->getDecoderOptions();
        $collection = new \sndsgd\http\data\Collection(
            $options->getMaxVars(),
            $options->getMaxNestingLevels()
        );

        foreach (explode(";", $header) as $cookie) {
            $cookie = trim($cookie);
            if ($cookie === "") {
                continue;
            }

            $pair = explode("=", $cookie, 2);
            if (!isset($pair[1]) || $pair[1] === "") {
                continue;
            }

            list($key, $value) = $pair;
            $collection->addValue(urldecode($key), urldecode($value));
        }

        return $collection->getValues();
    }
protected function parseCookies ( ) : array { # cookies are encoded in the `cookie` header $ header = $ this -> getHeader ( "cookie" ) ; if ( empty ( $ header ) ) { return [ ] ; } # create a data collection to gracefully handle arrays $ options = $ this -> getDecoderOptions ( ) ; $ collection = new \ sndsgd \ http \ data \ Collection ( $ options -> getMaxVars ( ) , $ options -> getMaxNestingLevels ( ) ) ; foreach ( explode ( ";" , $ header ) as $ cookie ) { $ cookie = trim ( $ cookie ) ; if ( $ cookie === "" ) { continue ; } $ pair = explode ( "=" , $ cookie , 2 ) ; if ( ! isset ( $ pair [ 1 ] ) || $ pair [ 1 ] === "" ) { continue ; } list ( $ key , $ value ) = $ pair ; $ collection -> addValue ( urldecode ( $ key ) , urldecode ( $ value ) ) ; } return $ collection -> getValues ( ) ; }
Parse cookies from the `cookie` header

@return array<string,mixed>
Parse cookies from the cookie header