public function __construct(Parser $parser) { $this->parser = $parser; $this->matcher = $parser->getMatcher(); $this->blockStack = new Stack(); $this->groupStack = new Stack(); $this->contextStack = new Stack(); $this->dispatcher = new EventDispatcher(); }
public function __construct(Parser $parser, Config $config, Writer $writer) { $this->config = $config; $this->writer = $writer; $this->parser = $parser; $this->context = $parser->getContext(); $this->matcher = $parser->getMatcher(); $this->init(); }
public function __construct(Parser $parser) { $this->parser = $parser; $this->matcher = $parser->getMatcher(); $this->units = new UnitCollection(); // register listeners $context = $parser->getContext(); $context->addListener(Context::EVENT_ROUTINE_LEAVE, [$this, 'onRoutineClosed']); $context->addListener(Context::EVENT_BLOCK_LEAVE, [$this, 'onBlockClosed']); }