10 private $results = [];
39 $this->lastError =
null;
40 if ( count( $headerList ) === 1 && $headerList[0] ===
'*' ) {
49 foreach ( $headerList as $header ) {
50 $this->parseHeader( $header );
52 return $this->results;
54 $this->lastError = $e->getMessage();
77 $this->lastError = $e->getMessage();
81 return $this->results[0];
90 return $this->lastError;
99 private function parseHeader( $header ) {
101 $this->consumeTagList();
110 private function consumeTagList() {
115 if ( $this->pos === $this->inputLength ) {
128 private function consumeTag() {
131 if ( substr( $this->input, $this->pos, 2 ) ===
'W/' ) {
137 if ( !preg_match(
'/[!#-~\x80-\xff]*/A', $this->input, $m, 0, $this->pos ) ) {
138 $this->
error(
'unexpected regex failure' );
141 $this->pos += strlen( $contents );
143 $whole .=
'"' . $contents .
'"';
146 'contents' => $contents,