* @since 2.0 */ class PathExpression extends Node { const TYPE_COLLECTION_VALUED_ASSOCIATION = 2; const TYPE_SINGLE_VALUED_ASSOCIATION = 4; const TYPE_STATE_FIELD = 8; private $_type; private $_expectedType; private $_identificationVariable; private $_parts; public function __construct($expectedType, $identificationVariable, array $parts) { $this->_expectedType = $expectedType; $this->_identificationVariable = $identificationVariable; $this->_parts = $parts; } public function getIdentificationVariable() { return $this->_identificationVariable; } public function getParts() { return $this->_parts; } public function setExpectedType($type) { $this->_expectedType; } public function getExpectedType() { return $this->_expectedType; } /** * INTERNAL */ public function setType($type) { $this->_type = $type; } public function getType() { return $this->_type; } public function dispatch($walker) { switch ($this->_type) { case self::TYPE_STATE_FIELD: return $walker->walkStateFieldPathExpression($this); case self::TYPE_SINGLE_VALUED_ASSOCIATION: return $walker->walkSingleValuedAssociationPathExpression($this); case self::TYPE_COLLECTION_VALUED_ASSOCIATION: return $walker->walkCollectionValuedAssociationPathExpression($this); default: throw new \Exception("Unexhaustive match."); } } }