From 699802c519e9779cd94dece288c840acf4c0ce51 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Wed, 10 Apr 2013 11:24:58 -0400 Subject: Added more documentation and tests to the Scanner. --- src/HTML5/Parser/Scanner.php | 49 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) (limited to 'src/HTML5') diff --git a/src/HTML5/Parser/Scanner.php b/src/HTML5/Parser/Scanner.php index 0260391..2500dab 100644 --- a/src/HTML5/Parser/Scanner.php +++ b/src/HTML5/Parser/Scanner.php @@ -85,16 +85,57 @@ class Scanner { } } + /** + * Get the next group of that is a hex value. + * + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @todo There is a potential for many false positives with this method. Make it more accurate. + * + * @return string + * The next group that is a hex value. + */ public function getHex() { - $this->charsWhile(self::CHARS_HEX); + return $this->is->charsWhile(self::CHARS_HEX); } + + /** + * Get the next group of characters that are ASCII Alpha characters. + * + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @return string + * The next group of ASCII alpha characters. + */ public function getAsciiAlpha() { - $this->charsWhile(self::CHARS_ALPHA); + return $this->is->charsWhile(self::CHARS_ALPHA); } + + /** + * Get the next group of characters that are ASCII Alpha characters and numbers. + * + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @return string + * The next group of ASCII alpha characters and numbers. + */ public function getAsciiAlphaNum() { - $this->charsWhile(self::CHARS_ALNUM); + return $this->is->charsWhile(self::CHARS_ALNUM); } + + /** + * Get the next group of numbers. + * + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @return string + * The next group of numbers. + */ public function getNumeric() { - $this->charsWhile('0123456789'); + return $this->is->charsWhile('0123456789'); } } -- cgit v1.2.3