diff options
author | Matt Farina <[email protected]> | 2013-04-10 11:24:58 -0400 |
---|---|---|
committer | Matt Farina <[email protected]> | 2013-04-10 11:24:58 -0400 |
commit | 699802c519e9779cd94dece288c840acf4c0ce51 (patch) | |
tree | 78afd610c3bbadb51c4aa0608bf34bc26a308527 /src/HTML5 | |
parent | 703bfebdb9ac177f108e2e86af92b2f59cdc8ab8 (diff) |
Added more documentation and tests to the Scanner.
Diffstat (limited to 'src/HTML5')
-rw-r--r-- | src/HTML5/Parser/Scanner.php | 49 |
1 files changed, 45 insertions, 4 deletions
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'); } } |