77use PHPCR \NodeType \NodeTypeTemplateInterface ;
88use PHPCR \NodeType \PropertyDefinitionTemplateInterface ;
99use PHPCR \PropertyType ;
10+ use PHPCR \Util \CND \Exception \ParserException ;
1011use PHPCR \Util \CND \Reader \BufferReader ;
1112use PHPCR \Util \CND \Reader \FileReader ;
1213use PHPCR \Util \CND \Reader \ReaderInterface ;
1314use PHPCR \Util \CND \Scanner \Context \DefaultScannerContextWithoutSpacesAndComments ;
1415use PHPCR \Util \CND \Scanner \GenericScanner ;
1516use PHPCR \Util \CND \Scanner \GenericToken as Token ;
16- use PHPCR \Util \CND \Exception \ParserException ;
1717use PHPCR \Version \OnParentVersionAction ;
1818
1919/**
2929 *
3030 * @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
3131 * @license http://opensource.org/licenses/MIT MIT License
32- *
3332 * @author Daniel Barsotti <daniel.barsotti@liip.ch>
3433 * @author David Buchmann <mail@davidbu.ch>
3534 */
3635class CndParser extends AbstractParser
3736{
3837 // node type attributes
39- private $ ORDERABLE = ['o ' , 'ord ' , 'orderable ' ];//, 'variant' => true);
40- private $ MIXIN = ['m ' , 'mix ' , 'mixin ' ];//, 'variant' => true);
41- private $ ABSTRACT = ['a ' , 'abs ' , 'abstract ' ];//, 'variant' => true);
42- private $ NOQUERY = ['noquery ' , 'nq ' ];//, 'variant' => false);
43- private $ QUERY = ['query ' , 'q ' ];//, 'variant' => false);
44- 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);
4544
4645 // common for properties and child definitions
4746 private $ PRIMARY = ['! ' , 'pri ' , 'primary ' ]; //, 'variant' => true),
@@ -90,7 +89,7 @@ public function __construct(NodeTypeManagerInterface $ntm)
9089 * @param string $filename absolute path to the CND file to read
9190 *
9291 * @return array with the namespaces map and the nodeTypes which is a
93- * hashmap of typename = > NodeTypeDefinitionInterface
92+ * hashmap of typename = > NodeTypeDefinitionInterface
9493 */
9594 public function parseFile ($ filename )
9695 {
@@ -105,7 +104,7 @@ public function parseFile($filename)
105104 * @param string $cnd string with CND content
106105 *
107106 * @return array with the namespaces map and the nodeTypes which is a
108- * hashmap of typename = > NodeTypeDefinitionInterface
107+ * hashmap of typename = > NodeTypeDefinitionInterface
109108 */
110109 public function parseString ($ cnd )
111110 {
@@ -131,7 +130,7 @@ private function parse(ReaderInterface $reader)
131130
132131 return [
133132 'namespaces ' => $ this ->namespaces ,
134- 'nodeTypes ' => $ this ->nodeTypes ,
133+ 'nodeTypes ' => $ this ->nodeTypes ,
135134 ];
136135 }
137136
@@ -283,7 +282,7 @@ protected function parseNodeTypeAttributes(NodeTypeTemplateInterface $nodeType)
283282 }
284283
285284 /**
286- * Parse both the children propery and nodes definitions
285+ * Parse both the children propery and nodes definitions.
287286 *
288287 * {PropertyDef | ChildNodeDef}
289288 */
@@ -369,11 +368,11 @@ protected function parsePropDef(NodeTypeTemplateInterface $nodeType)
369368 */
370369 protected function parsePropertyType (PropertyDefinitionTemplateInterface $ property )
371370 {
372- $ types = [" STRING " , " BINARY " , " LONG " , " DOUBLE " , " BOOLEAN " , " DATE " , " NAME " , " PATH " ,
373- " REFERENCE " , " WEAKREFERENCE " , " DECIMAL " , " URI " , " UNDEFINED " , " * " , " ? " ];
371+ $ types = [' STRING ' , ' BINARY ' , ' LONG ' , ' DOUBLE ' , ' BOOLEAN ' , ' DATE ' , ' NAME ' , ' PATH ' ,
372+ ' REFERENCE ' , ' WEAKREFERENCE ' , ' DECIMAL ' , ' URI ' , ' UNDEFINED ' , ' * ' , ' ? ' , ];
374373
375- if (! $ this ->checkTokenIn (Token::TK_IDENTIFIER , $ types , true )) {
376- throw new ParserException ($ this ->tokenQueue , sprintf (" Invalid property type: %s " , $ this ->tokenQueue ->get ()->getData ()));
374+ if (!$ this ->checkTokenIn (Token::TK_IDENTIFIER , $ types , true )) {
375+ throw new ParserException ($ this ->tokenQueue , sprintf (' Invalid property type: %s ' , $ this ->tokenQueue ->get ()->getData ()));
377376 }
378377
379378 $ data = $ this ->tokenQueue ->get ()->getData ();
@@ -387,7 +386,7 @@ protected function parsePropertyType(PropertyDefinitionTemplateInterface $proper
387386 * The default values, if any, are listed after a '='. The attribute is a
388387 * list in order to accommodate multi-value properties. The absence of this
389388 * element indicates that there is no static default value reportable. A '?'
390- * indicates that this attribute is a variant
389+ * indicates that this attribute is a variant.
391390 *
392391 * DefaultValues ::= '=' (StringList | '?')
393392 */
@@ -405,7 +404,7 @@ protected function parseDefaultValue(PropertyDefinitionTemplateInterface $proper
405404 /**
406405 * The value constraints, if any, are listed after a '<'. The absence of
407406 * this element indicates that no value constraints reportable within the
408- * value constraint syntax. A '?' indicates that this attribute is a variant
407+ * value constraint syntax. A '?' indicates that this attribute is a variant.
409408 *
410409 * ValueConstraints ::= '<' (StringList | '?')
411410 */
@@ -500,7 +499,7 @@ protected function parsePropertyAttributes(NodeTypeTemplateInterface $parentType
500499 $ property ->setQueryOrderable (false );
501500 } elseif ($ this ->checkTokenIn (Token::TK_IDENTIFIER , $ this ->OPV )) {
502501 if ($ opvSeen ) {
503- throw new ParserException ($ this ->tokenQueue , 'More than one on parent version action specified on property ' . $ property ->getName ());
502+ throw new ParserException ($ this ->tokenQueue , 'More than one on parent version action specified on property ' . $ property ->getName ());
504503 }
505504 $ token = $ this ->tokenQueue ->get ();
506505 $ property ->setOnParentVersion (OnParentVersionAction::valueFromName ($ token ->getData ()));
@@ -624,7 +623,7 @@ protected function parseChildNodeAttributes(
624623 }
625624
626625 /**
627- * Parse a string list
626+ * Parse a string list.
628627 *
629628 * StringList ::= String {',' String}
630629 *
@@ -643,7 +642,7 @@ protected function parseCndStringList()
643642 }
644643
645644 /**
646- * Parse a string
645+ * Parse a string.
647646 *
648647 * String ::= QuotedString | UnquotedString
649648 * QuotedString ::= SingleQuotedString | DoubleQuotedString
0 commit comments