MediaWiki REL1_35
|
A class to assist with the parsing of If-None-Match, If-Match and ETag headers. More...
Public Member Functions | |
getLastError () | |
Get the last parse error message, or null if there was none. | |
parseETag ( $eTag) | |
Parse an entity-tag such as might be found in an ETag response header. | |
parseHeaderList ( $headerList) | |
Parse an If-None-Match or If-Match header list as returned by RequestInterface::getHeader(). | |
Private Member Functions | |
consumeTag () | |
Consume a single entity-tag and append to the result array. | |
consumeTagList () | |
Consume a comma-separated list of entity-tags. | |
parseHeader ( $header) | |
Parse a single header. | |
Private Attributes | |
string null | $lastError |
$results = [] | |
Additional Inherited Members | |
Protected Member Functions inherited from MediaWiki\Rest\HeaderParser\HeaderParserBase | |
assertEnd () | |
If the position is not at the end of the input string, raise an error, complaining of trailing characters. | |
consumeFixedDigits ( $numDigits) | |
Consume a specified number of digits, or throw an exception. | |
consumeString ( $s) | |
Consume a specified string, or throw an exception. | |
error ( $message) | |
Throw an exception to indicate a parse error. | |
setInput ( $input) | |
Set the input, and derived convenience properties. | |
skipWhitespace () | |
Skip whitespace at the input position (OWS) | |
Protected Attributes inherited from MediaWiki\Rest\HeaderParser\HeaderParserBase | |
string | $input |
The input string being processed. | |
int | $inputLength |
The length of $input. | |
int | $pos |
The position within $input. | |
A class to assist with the parsing of If-None-Match, If-Match and ETag headers.
Definition at line 8 of file IfNoneMatch.php.
|
private |
Consume a single entity-tag and append to the result array.
HeaderParserError |
Definition at line 127 of file IfNoneMatch.php.
References MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeString(), and MediaWiki\Rest\HeaderParser\HeaderParserBase\error().
Referenced by MediaWiki\Rest\HeaderParser\IfNoneMatch\consumeTagList(), and MediaWiki\Rest\HeaderParser\IfNoneMatch\parseETag().
|
private |
Consume a comma-separated list of entity-tags.
HeaderParserError |
Definition at line 109 of file IfNoneMatch.php.
References MediaWiki\Rest\HeaderParser\HeaderParserBase\consumeString(), MediaWiki\Rest\HeaderParser\IfNoneMatch\consumeTag(), and MediaWiki\Rest\HeaderParser\HeaderParserBase\skipWhitespace().
Referenced by MediaWiki\Rest\HeaderParser\IfNoneMatch\parseHeader().
MediaWiki\Rest\HeaderParser\IfNoneMatch::getLastError | ( | ) |
Get the last parse error message, or null if there was none.
Definition at line 88 of file IfNoneMatch.php.
References MediaWiki\Rest\HeaderParser\IfNoneMatch\$lastError.
MediaWiki\Rest\HeaderParser\IfNoneMatch::parseETag | ( | $eTag | ) |
Parse an entity-tag such as might be found in an ETag response header.
The result is an associative array in the same format returned by parseHeaderList().
If parsing failed, null is returned.
string | $eTag |
Definition at line 68 of file IfNoneMatch.php.
References MediaWiki\Rest\HeaderParser\HeaderParserBase\assertEnd(), MediaWiki\Rest\HeaderParser\IfNoneMatch\consumeTag(), and MediaWiki\Rest\HeaderParser\HeaderParserBase\setInput().
Referenced by MediaWiki\Rest\ConditionalHeaderUtil\checkPreconditions().
|
private |
Parse a single header.
string | $header |
HeaderParserError |
Definition at line 98 of file IfNoneMatch.php.
References $header, MediaWiki\Rest\HeaderParser\HeaderParserBase\assertEnd(), MediaWiki\Rest\HeaderParser\IfNoneMatch\consumeTagList(), and MediaWiki\Rest\HeaderParser\HeaderParserBase\setInput().
Referenced by MediaWiki\Rest\HeaderParser\IfNoneMatch\parseHeaderList().
MediaWiki\Rest\HeaderParser\IfNoneMatch::parseHeaderList | ( | $headerList | ) |
Parse an If-None-Match or If-Match header list as returned by RequestInterface::getHeader().
The return value is an array of tag info arrays. Each tag info array is an associative array with the following keys:
In the case of a wildcard header like "If-Match: *", there cannot be any other tags. The return value is an array with a single tag info array with 'whole' => '*'.
If the header was invalid, an empty array will be returned. Further information about why the parsing failed can be found by calling getLastError().
string[] | $headerList |
Definition at line 37 of file IfNoneMatch.php.
References $header, MediaWiki\Rest\HeaderParser\IfNoneMatch\$results, and MediaWiki\Rest\HeaderParser\IfNoneMatch\parseHeader().
|
private |
Definition at line 12 of file IfNoneMatch.php.
Referenced by MediaWiki\Rest\HeaderParser\IfNoneMatch\getLastError().
|
private |
Definition at line 9 of file IfNoneMatch.php.
Referenced by MediaWiki\Rest\HeaderParser\IfNoneMatch\parseHeaderList().