Пример #1
0
 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;
 }
Пример #2
0
 public function addCompilerExtension(ICompilerExtension $compilerExtension)
 {
     $this->eventBus->register($compilerExtension);
     return $this;
 }
Пример #3
0
 public function onInstanceEvent(InstanceEvent $event)
 {
     $this->eventBus->register($event->getInstance());
 }