src/parser/class.js
function(asInterface) {
    const result = [-1, -1, -1];
    if (this.is("T_MEMBER_FLAGS")) {
      let idx = 0,
        val = 0;
      do {
        switch (this.token) {
          case this.tok.T_PUBLIC:
            idx = 0;
            val = 0;
            break;
          case this.tok.T_PROTECTED:
            idx = 0;
            val = 1;
            break;
          case this.tok.T_PRIVATE:
            idx = 0;
            val = 2;
            break;
          case this.tok.T_STATIC:
            idx = 1;
            val = 1;
            break;
          case this.tok.T_ABSTRACT:
            idx = 2;
            val = 1;
            break;
          case this.tok.T_FINAL:
            idx = 2;
            val = 2;
            break;
        }
        if (asInterface) {
          if (idx == 0 && val == 2) {
            // an interface can't be private
            this.expect([this.tok.T_PUBLIC, this.tok.T_PROTECTED]);
            val = -1;
          } else if (idx == 2 && val == 1) {
            // an interface cant be abstract
            this.error();
            val = -1;
          }
        }
        if (result[idx] !== -1) {
          // already defined flag
          this.error();
        } else if (val !== -1) {
          result[idx] = val;
        }
      } while (this.next().is("T_MEMBER_FLAGS"));
    }

    if (result[1] == -1) result[1] = 0;
    if (result[2] == -1) result[2] = 0;
    return result;
  }
function(asInterface) {
    const result = [-1, -1, -1];
    if (this.is("T_MEMBER_FLAGS")) {
      let idx = 0,
        val = 0;
      do {
        switch (this.token) {
          case this.tok.T_PUBLIC:
            idx = 0;
            val = 0;
            break;
          case this.tok.T_PROTECTED:
            idx = 0;
            val = 1;
            break;
          case this.tok.T_PRIVATE:
            idx = 0;
            val = 2;
            break;
          case this.tok.T_STATIC:
            idx = 1;
            val = 1;
            break;
          case this.tok.T_ABSTRACT:
            idx = 2;
            val = 1;
            break;
          case this.tok.T_FINAL:
            idx = 2;
            val = 2;
            break;
        }
        if (asInterface) {
          if (idx == 0 && val == 2) {
            // an interface can't be private
            this.expect([this.tok.T_PUBLIC, this.tok.T_PROTECTED]);
            val = -1;
          } else if (idx == 2 && val == 1) {
            // an interface cant be abstract
            this.error();
            val = -1;
          }
        }
        if (result[idx] !== -1) {
          // already defined flag
          this.error();
        } else if (val !== -1) {
          result[idx] = val;
        }
      } while (this.next().is("T_MEMBER_FLAGS"));
    }

    if (result[1] == -1) result[1] = 0;
    if (result[2] == -1) result[2] = 0;
    return result;
  }
function ( asInterface ) { const result = [ - 1 , - 1 , - 1 ] ; if ( this . is ( "T_MEMBER_FLAGS" ) ) { let idx = 0 , val = 0 ; do { switch ( this . token ) { case this . tok . T_PUBLIC : idx = 0 ; val = 0 ; break ; case this . tok . T_PROTECTED : idx = 0 ; val = 1 ; break ; case this . tok . T_PRIVATE : idx = 0 ; val = 2 ; break ; case this . tok . T_STATIC : idx = 1 ; val = 1 ; break ; case this . tok . T_ABSTRACT : idx = 2 ; val = 1 ; break ; case this . tok . T_FINAL : idx = 2 ; val = 2 ; break ; } if ( asInterface ) { if ( idx == 0 && val == 2 ) { // an interface can't be private this . expect ( [ this . tok . T_PUBLIC , this . tok . T_PROTECTED ] ) ; val = - 1 ; } else if ( idx == 2 && val == 1 ) { // an interface cant be abstract this . error ( ) ; val = - 1 ; } } if ( result [ idx ] !== - 1 ) { // already defined flag this . error ( ) ; } else if ( val !== - 1 ) { result [ idx ] = val ; } } while ( this . next ( ) . is ( "T_MEMBER_FLAGS" ) ) ; } if ( result [ 1 ] == - 1 ) result [ 1 ] = 0 ; if ( result [ 2 ] == - 1 ) result [ 2 ] = 0 ; return result ; }
Read member flags
@return array
1st index : 0 => public, 1 => protected, 2 => private
2nd index : 0 => instance member, 1 => static member
3rd index : 0 => normal, 1 => abstract member, 2 => final member
Read member flags