From 9a9c04512e5dcb77c7fe5d850e3f2a0250cc160e Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 18 Jan 2017 20:07:16 +0100 Subject: * Motor Sport Magazine feed provider --- lib/querypath/src/QueryPath/CSS/InputStream.php | 57 +++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 lib/querypath/src/QueryPath/CSS/InputStream.php (limited to 'lib/querypath/src/QueryPath/CSS/InputStream.php') diff --git a/lib/querypath/src/QueryPath/CSS/InputStream.php b/lib/querypath/src/QueryPath/CSS/InputStream.php new file mode 100644 index 0000000..2967845 --- /dev/null +++ b/lib/querypath/src/QueryPath/CSS/InputStream.php @@ -0,0 +1,57 @@ +stream = str_split($string); + } + /** + * Look ahead one character. + * + * @return char + * Returns the next character, but does not remove it from + * the stream. + */ + function peek() { + return $this->stream[0]; + } + /** + * Get the next unconsumed character in the stream. + * This will remove that character from the front of the + * stream and return it. + */ + function consume() { + $ret = array_shift($this->stream); + if (!empty($ret)) { + $this->position++; + } + return $ret; + } + /** + * Check if the stream is empty. + * @return boolean + * Returns TRUE when the stream is empty, FALSE otherwise. + */ + function isEmpty() { + return count($this->stream) == 0; + } +} -- cgit v1.2.3