public function getIterator() { return StringUtils::createIterator($this->get()); }
public function read(IResource $resource, $handler) { $value = null; $this->eventBus = new EventBus(); $this->eventBus->register($handler); foreach ($resource as $chunk) { foreach ($iterator = StringUtils::createIterator($chunk) as $char) { switch ($char) { case '<': if ($value !== null) { $this->eventBus->emit(new TextEvent($value)); } $this->parseTag($iterator->setContinue()); $value = null; break; default: $value .= $char; } } } return $this; }