1: <?php
2: namespace Pharborist\ControlStructures;
3:
4: use Pharborist\TokenNode;
5:
6: /**
7: * Trait for control structures that support alternative syntax.
8: */
9: trait AltSyntaxTrait {
10: /**
11: * @var TokenNode
12: */
13: protected $openColon;
14:
15: /**
16: * @var TokenNode
17: */
18: protected $endKeyword;
19:
20: /**
21: * The colon (':') delimiter for body of statements.
22: *
23: * @return TokenNode
24: */
25: public function getOpenColon() {
26: return $this->openColon;
27: }
28:
29: /**
30: * The end keyword delimiter for end of control structure.
31: *
32: * @return TokenNode
33: */
34: public function getEndKeyword() {
35: return $this->endKeyword;
36: }
37:
38: /**
39: * Return if control structure is using the altnerative syntax.
40: *
41: * @return bool
42: */
43: public function isAlterativeSyntax() {
44: return $this->endKeyword !== NULL;
45: }
46: }
47: