3535class CndParser extends AbstractParser
3636{
3737 // node type attributes
38- private $ ORDERABLE = ['o ' , 'ord ' , 'orderable ' ]; //, 'variant' => true);
39- private $ MIXIN = ['m ' , 'mix ' , 'mixin ' ]; //, 'variant' => true);
40- private $ ABSTRACT = ['a ' , 'abs ' , 'abstract ' ]; //, 'variant' => true);
41- private $ NOQUERY = ['noquery ' , 'nq ' ]; //, 'variant' => false);
42- private $ QUERY = ['query ' , 'q ' ]; //, 'variant' => false);
43- private $ PRIMARYITEM = ['primaryitem ' , '! ' ]; //, 'variant' => false);
38+ private $ ORDERABLE = ['o ' , 'ord ' , 'orderable ' ]; // , 'variant' => true);
39+ private $ MIXIN = ['m ' , 'mix ' , 'mixin ' ]; // , 'variant' => true);
40+ private $ ABSTRACT = ['a ' , 'abs ' , 'abstract ' ]; // , 'variant' => true);
41+ private $ NOQUERY = ['noquery ' , 'nq ' ]; // , 'variant' => false);
42+ private $ QUERY = ['query ' , 'q ' ]; // , 'variant' => false);
43+ private $ PRIMARYITEM = ['primaryitem ' , '! ' ]; // , 'variant' => false);
4444
4545 // common for properties and child definitions
46- private $ PRIMARY = ['! ' , 'pri ' , 'primary ' ]; //, 'variant' => true),
47- private $ AUTOCREATED = ['a ' , 'aut ' , 'autocreated ' ]; //, 'variant' => true),
48- private $ MANDATORY = ['m ' , 'man ' , 'mandatory ' ]; //, 'variant' => true),
49- private $ PROTECTED = ['p ' , 'pro ' , 'protected ' ]; //, 'variant' => true),
46+ private $ PRIMARY = ['! ' , 'pri ' , 'primary ' ]; // , 'variant' => true),
47+ private $ AUTOCREATED = ['a ' , 'aut ' , 'autocreated ' ]; // , 'variant' => true),
48+ private $ MANDATORY = ['m ' , 'man ' , 'mandatory ' ]; // , 'variant' => true),
49+ private $ PROTECTED = ['p ' , 'pro ' , 'protected ' ]; // , 'variant' => true),
5050 private $ OPV = ['COPY ' , 'VERSION ' , 'INITIALIZE ' , 'COMPUTE ' , 'IGNORE ' , 'ABORT ' ];
5151
5252 // property type attributes
53- private $ MULTIPLE = ['* ' , 'mul ' , 'multiple ' ]; //, 'variant' => true),
54- private $ QUERYOPS = ['qop ' , 'queryops ' ]; //, 'variant' => true), // Needs special handling !
55- private $ NOFULLTEXT = ['nof ' , 'nofulltext ' ]; //, 'variant' => true),
56- private $ NOQUERYORDER = ['nqord ' , 'noqueryorder ' ]; //, 'variant' => true),
53+ private $ MULTIPLE = ['* ' , 'mul ' , 'multiple ' ]; // , 'variant' => true),
54+ private $ QUERYOPS = ['qop ' , 'queryops ' ]; // , 'variant' => true), // Needs special handling !
55+ private $ NOFULLTEXT = ['nof ' , 'nofulltext ' ]; // , 'variant' => true),
56+ private $ NOQUERYORDER = ['nqord ' , 'noqueryorder ' ]; // , 'variant' => true),
5757
5858 // child node attributes
5959 // multiple is actually a jackrabbit specific synonym for sns
6060 // http://www.mail-archive.com/users@jackrabbit.apache.org/msg19268.html
61- private $ SNS = ['* ' , 'sns ' , 'multiple ' ]; //, 'variant' => true),
61+ private $ SNS = ['* ' , 'sns ' , 'multiple ' ]; // , 'variant' => true),
6262
6363 /**
6464 * @var NodeTypeManagerInterface
@@ -75,9 +75,6 @@ class CndParser extends AbstractParser
7575 */
7676 protected $ nodeTypes = [];
7777
78- /**
79- * @param NodeTypeManagerInterface $ntm
80- */
8178 public function __construct (NodeTypeManagerInterface $ ntm )
8279 {
8380 $ this ->ntm = $ ntm ;
@@ -130,7 +127,7 @@ private function parse(ReaderInterface $reader)
130127
131128 return [
132129 'namespaces ' => $ this ->namespaces ,
133- 'nodeTypes ' => $ this ->nodeTypes ,
130+ 'nodeTypes ' => $ this ->nodeTypes ,
134131 ];
135132 }
136133
@@ -350,7 +347,7 @@ protected function parsePropDef(NodeTypeTemplateInterface $nodeType)
350347 // Next token is '<' and two token later it's not '=', i.e. not '<ident='
351348 $ next1 = $ this ->tokenQueue ->peek ();
352349 $ next2 = $ this ->tokenQueue ->peek (2 );
353- if ($ next1 && $ next1 ->getData () === ' < ' && (!$ next2 || $ next2 ->getData () !== ' = ' )) {
350+ if ($ next1 && ' < ' === $ next1 ->getData () && (!$ next2 || ' = ' !== $ next2 ->getData ())) {
354351 $ this ->parseValueConstraints ($ property );
355352 }
356353 }
@@ -678,21 +675,21 @@ protected function parseCndString()
678675 $ type = $ token ->getType ();
679676 $ data = $ token ->getData ();
680677
681- if ($ type === Token:: TK_STRING ) {
678+ if (Token:: TK_STRING === $ type ) {
682679 $ string = substr ($ data , 1 , -1 );
683680 $ this ->tokenQueue ->next ();
684681
685682 return $ string ;
686683 }
687684
688685 // If it's not an identifier or a symbol allowed in a string, break
689- if ($ type !== Token::TK_IDENTIFIER && $ type !== Token::TK_SYMBOL
690- || ($ type === Token:: TK_SYMBOL && $ data !== ' _ ' && $ data !== ' : ' )) {
686+ if (Token::TK_IDENTIFIER !== $ type && Token::TK_SYMBOL !== $ type
687+ || (Token:: TK_SYMBOL === $ type && ' _ ' !== $ data && ' : ' !== $ data )) {
691688 break ;
692689 }
693690
694691 // Detect spaces (an identifier cannot be followed by an identifier as it would have been read as a single token)
695- if ($ type === Token::TK_IDENTIFIER && $ lastType === Token:: TK_IDENTIFIER ) {
692+ if (Token:: TK_IDENTIFIER === $ type && Token::TK_IDENTIFIER === $ lastType ) {
696693 break ;
697694 }
698695
@@ -702,7 +699,7 @@ protected function parseCndString()
702699 $ lastType = $ type ;
703700 }
704701
705- if ($ string === '' ) {
702+ if ('' === $ string ) {
706703 throw new ParserException ($ this ->tokenQueue , sprintf ("Expected CND string, found '%s': " , $ this ->tokenQueue ->peek ()->getData ()));
707704 }
708705
@@ -752,10 +749,10 @@ protected function parseQueryOperator()
752749
753750 switch ($ data ) {
754751 case '< ' :
755- $ op = ($ nextData === ' > ' ? '>= ' : ($ nextData === ' = ' ? '<= ' : '< ' ));
752+ $ op = (' > ' === $ nextData ? '>= ' : (' = ' === $ nextData ? '<= ' : '< ' ));
756753 break ;
757754 case '> ' :
758- $ op = ($ nextData === ' = ' ? '>= ' : '> ' );
755+ $ op = (' = ' === $ nextData ? '>= ' : '> ' );
759756 break ;
760757 case '= ' :
761758 $ op = '= ' ;
@@ -766,9 +763,9 @@ protected function parseQueryOperator()
766763 }
767764
768765 // Consume the correct number of tokens
769- if ($ op === ' LIKE ' || strlen ( $ op ) === 1 ) {
766+ if (' LIKE ' === $ op || 1 === strlen ( $ op ) ) {
770767 $ this ->tokenQueue ->next ();
771- } elseif (strlen ( $ op ) === 2 ) {
768+ } elseif (2 === strlen ( $ op ) ) {
772769 $ this ->tokenQueue ->next ();
773770 $ this ->tokenQueue ->next ();
774771 }
0 commit comments