+ if ( $prefix === null ) {
+ global $wgCookiePrefix;
+ $prefix = $wgCookiePrefix;
+ }
+ $name = $prefix . $key;
+ return isset( $this->cookies[$name] ) ? $this->cookies[$name] : $default;
+ }
+
+ /**
+ * @since 1.26
+ * @param string $name Unprefixed name of the cookie to set
+ * @param string|null $value Value of the cookie to set
+ * @param string|null $prefix Cookie prefix. Defaults to $wgCookiePrefix
+ */
+ public function setCookie( $key, $value, $prefix = null ) {
+ $this->setCookies( array( $key => $value ), $prefix );
+ }
+
+ /**
+ * @since 1.26
+ * @param array $cookies
+ * @param string|null $prefix Cookie prefix. Defaults to $wgCookiePrefix
+ */
+ public function setCookies( $cookies, $prefix = null ) {
+ if ( $prefix === null ) {
+ global $wgCookiePrefix;
+ $prefix = $wgCookiePrefix;
+ }
+ foreach ( $cookies as $key => $value ) {
+ $name = $prefix . $key;
+ $this->cookies[$name] = $value;
+ }