Exemplo n.º 1
0
 public function __construct($role = parent::DOCUMENT_ROLE, BNodeLabeler $labeler = null)
 {
     parent::__construct($role, $labeler);
     $this->transitionTable[self::STATE_START][self::STATE_DOCUMENT] = function () {
         $this->beginDocument();
     };
     $this->transitionTable[self::STATE_DOCUMENT][self::STATE_FINISH] = function () {
         $this->finishDocument();
     };
     $this->transitionTable[self::STATE_OBJECT][self::STATE_DOCUMENT] = function () {
         $this->finishSubject();
     };
     $this->transitionTable[self::STATE_OBJECT][self::STATE_SUBJECT] = function () {
         $this->finishSubject();
     };
 }
 public function __construct($role = parent::DOCUMENT_ROLE, BNodeLabeler $labeler = null)
 {
     parent::__construct($role, $labeler);
     // Unfortunately, this is a bit ugly since PHP 5.3 can't call array($this, 'foo') directly
     // Also due to PHP 5.3 scope issues, used functions need to be public.
     // TODO: seek better solution (or move to PHP 5.4+)
     $self = $this;
     $this->transitionTable[self::STATE_START][self::STATE_DOCUMENT] = function () use($self) {
         $self->beginDocument();
     };
     array($this, 'beginDocument');
     $this->transitionTable[self::STATE_DOCUMENT][self::STATE_FINISH] = function () use($self) {
         $self->finishDocument();
     };
     $this->transitionTable[self::STATE_OBJECT][self::STATE_DOCUMENT] = function () use($self) {
         $self->finishSubject();
     };
     $this->transitionTable[self::STATE_OBJECT][self::STATE_SUBJECT] = function () use($self) {
         $self->finishSubject();
     };
 }