summaryrefslogtreecommitdiff
path: root/src/HTML5/Parser/StringInputStream.php
diff options
context:
space:
mode:
authorTitouan Galopin <[email protected]>2018-11-03 01:03:34 +0100
committerTitouan Galopin <[email protected]>2018-11-03 01:36:52 +0100
commit321ed9626c091f1f4dcef8223d88ee88a400a241 (patch)
tree32a565fac06feba41230228a806dc22d6e8f17c3 /src/HTML5/Parser/StringInputStream.php
parent7453ab08dc4c8f65d5db52fd2c6b8943d59bf95b (diff)
Improve performance by relying on a native string instead of InputStream
Diffstat (limited to 'src/HTML5/Parser/StringInputStream.php')
-rw-r--r--src/HTML5/Parser/StringInputStream.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/HTML5/Parser/StringInputStream.php b/src/HTML5/Parser/StringInputStream.php
index 0973941..0118468 100644
--- a/src/HTML5/Parser/StringInputStream.php
+++ b/src/HTML5/Parser/StringInputStream.php
@@ -39,9 +39,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// - // indicates regular comments
+/**
+ * @deprecated since 2.4, to remove in 3.0. Use a string in the scanner instead.
+ */
class StringInputStream implements InputStream
{
-
/**
* The string data we're parsing.
*/
@@ -88,6 +90,11 @@ class StringInputStream implements InputStream
$this->EOF = strlen($data);
}
+ public function __toString()
+ {
+ return $this->data;
+ }
+
/**
* Replace linefeed characters according to the spec.
*/