public function protectedCookie(
        $name,
        $mode = self::COOKIE_DEFAULT
    ) {
        Types::assert(
            [
                'string|array' => [$name],
                'int' => [$mode]
            ]
        );

        if (is_string($name))
        {
            $name = strtolower($name);
        }
        elseif (is_array($name))
        {
            foreach ($name as $cookie)
            {
                $this->protectedCookie($cookie, $mode);
            }
            return;
        }

        $stringTypes = [];

        if (($mode & self::COOKIE_NAME) === self::COOKIE_NAME)
        {
            $stringTypes[] = 'names';
        }

        if (($mode & self::COOKIE_SUBSTR) === self::COOKIE_SUBSTR)
        {
            $stringTypes[] = 'substrings';
        }

        foreach ($stringTypes as $type)
        {
            if (
                ($mode & self::COOKIE_REMOVE) !== self::COOKIE_REMOVE
            and ! in_array($name, $this->protectedCookies[$type])
            ) {
                $this->protectedCookies[$type][] = $name;
            }
            elseif (
                ($mode & self::COOKIE_REMOVE) === self::COOKIE_REMOVE
                and (
                    $key = array_search(
                        $name,
                        $this->protectedCookies[$type]
                    )
                ) !== false
            ) {
                unset($this->protectedCookies[$type][$key]);
            }
        }
    }
public function protectedCookie(
        $name,
        $mode = self::COOKIE_DEFAULT
    ) {
        Types::assert(
            [
                'string|array' => [$name],
                'int' => [$mode]
            ]
        );

        if (is_string($name))
        {
            $name = strtolower($name);
        }
        elseif (is_array($name))
        {
            foreach ($name as $cookie)
            {
                $this->protectedCookie($cookie, $mode);
            }
            return;
        }

        $stringTypes = [];

        if (($mode & self::COOKIE_NAME) === self::COOKIE_NAME)
        {
            $stringTypes[] = 'names';
        }

        if (($mode & self::COOKIE_SUBSTR) === self::COOKIE_SUBSTR)
        {
            $stringTypes[] = 'substrings';
        }

        foreach ($stringTypes as $type)
        {
            if (
                ($mode & self::COOKIE_REMOVE) !== self::COOKIE_REMOVE
            and ! in_array($name, $this->protectedCookies[$type])
            ) {
                $this->protectedCookies[$type][] = $name;
            }
            elseif (
                ($mode & self::COOKIE_REMOVE) === self::COOKIE_REMOVE
                and (
                    $key = array_search(
                        $name,
                        $this->protectedCookies[$type]
                    )
                ) !== false
            ) {
                unset($this->protectedCookies[$type][$key]);
            }
        }
    }
public function protectedCookie ( $ name , $ mode = self :: COOKIE_DEFAULT ) { Types :: assert ( [ 'string|array' => [ $ name ] , 'int' => [ $ mode ] ] ) ; if ( is_string ( $ name ) ) { $ name = strtolower ( $ name ) ; } elseif ( is_array ( $ name ) ) { foreach ( $ name as $ cookie ) { $ this -> protectedCookie ( $ cookie , $ mode ) ; } return ; } $ stringTypes = [ ] ; if ( ( $ mode & self :: COOKIE_NAME ) === self :: COOKIE_NAME ) { $ stringTypes [ ] = 'names' ; } if ( ( $ mode & self :: COOKIE_SUBSTR ) === self :: COOKIE_SUBSTR ) { $ stringTypes [ ] = 'substrings' ; } foreach ( $ stringTypes as $ type ) { if ( ( $ mode & self :: COOKIE_REMOVE ) !== self :: COOKIE_REMOVE and ! in_array ( $ name , $ this -> protectedCookies [ $ type ] ) ) { $ this -> protectedCookies [ $ type ] [ ] = $ name ; } elseif ( ( $ mode & self :: COOKIE_REMOVE ) === self :: COOKIE_REMOVE and ( $ key = array_search ( $ name , $ this -> protectedCookies [ $ type ] ) ) !== false ) { unset ( $ this -> protectedCookies [ $ type ] [ $ key ] ) ; } } }
Configure which cookies SecureHeaders will regard as protected.

SecureHeaders will consider substrings and names of cookies separately.
By default, cookies that case insensitively match the following
substrings or names will be regarded as protected.

#### Substrings
```
sess
auth
login
csrf
xsrf
token
antiforgery
```

#### Names
```
sid
s
persistent
```

If a cookie is protected, then cookie flags will be appended as
configured by {@see auto}. The default behaviour is to add `Secure`,
`HttpOnly`, and `SameSite=Lax` to ensure cookies are both sent securely,
out of the reach of JavaScript, and fairly resistant to csrf attacks.

@api

@param string|array $name
The name (or substring of the name, depending on mode configuration),
of the cookie to add/remove from the protection list (depending on mode
configuration). Or a list of cookie names (or substrings of the name to
match) as an array of strings.
@param int $mode
`mode` accepts one or more of the following constants. Multiple
constants may be specified by combination using
[bitwise operators](https://secure.php.net/manual/language.operators.bitwise.php)

@return void
Configure which cookies SecureHeaders will regard as protected .