1: | <?php declare(strict_types=1); |
2: | |
3: | namespace PhpParser\Node\Stmt; |
4: | |
5: | use PhpParser\Node; |
6: | |
7: | class ClassConst extends Node\Stmt |
8: | { |
9: | |
10: | public $flags; |
11: | |
12: | public $consts; |
13: | |
14: | public $attrGroups; |
15: | |
16: | public $type; |
17: | |
18: | |
19: | |
20: | |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | public function __construct( |
28: | array $consts, |
29: | int $flags = 0, |
30: | array $attributes = [], |
31: | array $attrGroups = [], |
32: | $type = null |
33: | ) { |
34: | $this->attributes = $attributes; |
35: | $this->flags = $flags; |
36: | $this->consts = $consts; |
37: | $this->attrGroups = $attrGroups; |
38: | $this->type = \is_string($type) ? new Node\Identifier($type) : $type; |
39: | } |
40: | |
41: | public function getSubNodeNames() : array { |
42: | return ['attrGroups', 'flags', 'type', 'consts']; |
43: | } |
44: | |
45: | |
46: | |
47: | |
48: | |
49: | |
50: | public function isPublic() : bool { |
51: | return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 |
52: | || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; |
53: | } |
54: | |
55: | |
56: | |
57: | |
58: | |
59: | |
60: | public function isProtected() : bool { |
61: | return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); |
62: | } |
63: | |
64: | |
65: | |
66: | |
67: | |
68: | |
69: | public function isPrivate() : bool { |
70: | return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); |
71: | } |
72: | |
73: | |
74: | |
75: | |
76: | |
77: | |
78: | public function isFinal() : bool { |
79: | return (bool) ($this->flags & Class_::MODIFIER_FINAL); |
80: | } |
81: | |
82: | public function getType() : string { |
83: | return 'Stmt_ClassConst'; |
84: | } |
85: | } |
86: | |