@@ -88,12 +88,12 @@ protected function parseUntaggedResponse(): UntaggedResponse
8888 $ this ->advance ();
8989
9090 // Collect all tokens until the end-of-response marker.
91- while ($ this ->currentToken && ! $ this ->isEndOfResponseToken ( $ this -> currentToken ) ) {
91+ while ($ this ->currentToken && ! $ this ->currentToken instanceof Crlf ) {
9292 $ elements [] = $ this ->parseElement ();
9393 }
9494
9595 // If the end-of-response marker (CRLF) is present, consume it.
96- if ($ this ->currentToken && $ this ->isEndOfResponseToken ( $ this -> currentToken ) ) {
96+ if ($ this ->currentToken && $ this ->currentToken instanceof Crlf ) {
9797 $ this ->currentToken = null ;
9898 } else {
9999 throw new ImapParserException ('Unterminated untagged response ' );
@@ -116,12 +116,12 @@ protected function parseContinuationResponse(): ContinuationResponse
116116 $ this ->advance ();
117117
118118 // Collect all tokens until the CRLF marker.
119- while ($ this ->currentToken && ! $ this ->isEndOfResponseToken ( $ this -> currentToken ) ) {
119+ while ($ this ->currentToken && ! $ this ->currentToken instanceof Crlf ) {
120120 $ elements [] = $ this ->parseElement ();
121121 }
122122
123123 // Consume the CRLF marker if present.
124- if ($ this ->currentToken && $ this ->isEndOfResponseToken ( $ this -> currentToken ) ) {
124+ if ($ this ->currentToken && $ this ->currentToken instanceof Crlf ) {
125125 $ this ->currentToken = null ;
126126 } else {
127127 throw new ImapParserException ('Unterminated continuation response ' );
@@ -144,12 +144,12 @@ protected function parseTaggedResponse(): TaggedResponse
144144 $ this ->advance ();
145145
146146 // Collect tokens until the end-of-response marker is reached.
147- while ($ this ->currentToken && ! $ this ->isEndOfResponseToken ( $ this -> currentToken ) ) {
147+ while ($ this ->currentToken && ! $ this ->currentToken instanceof Crlf ) {
148148 $ tokens [] = $ this ->parseElement ();
149149 }
150150
151151 // Consume the CRLF marker if present.
152- if ($ this ->currentToken && $ this ->isEndOfResponseToken ( $ this -> currentToken ) ) {
152+ if ($ this ->currentToken && $ this ->currentToken instanceof Crlf ) {
153153 $ this ->currentToken = null ;
154154 } else {
155155 throw new ImapParserException ('Unterminated tagged response ' );
@@ -267,12 +267,4 @@ protected function advance(): void
267267 {
268268 $ this ->currentToken = $ this ->tokenizer ->nextToken ();
269269 }
270-
271- /**
272- * Determine if the given token marks the end of a response.
273- */
274- protected function isEndOfResponseToken (Token $ token ): bool
275- {
276- return $ token instanceof Crlf;
277- }
278270}
0 commit comments