| 1: | <?php declare(strict_types=1); |
| 2: | |
| 3: | namespace PhpParser\Node\Stmt; |
| 4: | |
| 5: | use PhpParser\Modifiers; |
| 6: | use PhpParser\Node; |
| 7: | use PhpParser\Node\ComplexType; |
| 8: | use PhpParser\Node\Identifier; |
| 9: | use PhpParser\Node\Name; |
| 10: | use PhpParser\Node\PropertyItem; |
| 11: | |
| 12: | class Property extends Node\Stmt { |
| 13: | |
| 14: | public int $flags; |
| 15: | |
| 16: | public array $props; |
| 17: | |
| 18: | public ?Node $type; |
| 19: | |
| 20: | public array $attrGroups; |
| 21: | |
| 22: | public array $hooks; |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public function __construct(int $flags, array $props, array $attributes = [], ?Node $type = null, array $attrGroups = [], array $hooks = []) { |
| 35: | $this->attributes = $attributes; |
| 36: | $this->flags = $flags; |
| 37: | $this->props = $props; |
| 38: | $this->type = $type; |
| 39: | $this->attrGroups = $attrGroups; |
| 40: | $this->hooks = $hooks; |
| 41: | } |
| 42: | |
| 43: | public function getSubNodeNames(): array { |
| 44: | return ['attrGroups', 'flags', 'type', 'props', 'hooks']; |
| 45: | } |
| 46: | |
| 47: | |
| 48: | |
| 49: | |
| 50: | public function isPublic(): bool { |
| 51: | return ($this->flags & Modifiers::PUBLIC) !== 0 |
| 52: | || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; |
| 53: | } |
| 54: | |
| 55: | |
| 56: | |
| 57: | |
| 58: | public function isProtected(): bool { |
| 59: | return (bool) ($this->flags & Modifiers::PROTECTED); |
| 60: | } |
| 61: | |
| 62: | |
| 63: | |
| 64: | |
| 65: | public function isPrivate(): bool { |
| 66: | return (bool) ($this->flags & Modifiers::PRIVATE); |
| 67: | } |
| 68: | |
| 69: | |
| 70: | |
| 71: | |
| 72: | public function isStatic(): bool { |
| 73: | return (bool) ($this->flags & Modifiers::STATIC); |
| 74: | } |
| 75: | |
| 76: | |
| 77: | |
| 78: | |
| 79: | public function isReadonly(): bool { |
| 80: | return (bool) ($this->flags & Modifiers::READONLY); |
| 81: | } |
| 82: | |
| 83: | |
| 84: | |
| 85: | |
| 86: | public function isAbstract(): bool { |
| 87: | return (bool) ($this->flags & Modifiers::ABSTRACT); |
| 88: | } |
| 89: | |
| 90: | |
| 91: | |
| 92: | |
| 93: | public function isFinal(): bool { |
| 94: | return (bool) ($this->flags & Modifiers::FINAL); |
| 95: | } |
| 96: | |
| 97: | |
| 98: | |
| 99: | |
| 100: | public function isPublicSet(): bool { |
| 101: | return (bool) ($this->flags & Modifiers::PUBLIC_SET); |
| 102: | } |
| 103: | |
| 104: | |
| 105: | |
| 106: | |
| 107: | public function isProtectedSet(): bool { |
| 108: | return (bool) ($this->flags & Modifiers::PROTECTED_SET); |
| 109: | } |
| 110: | |
| 111: | |
| 112: | |
| 113: | |
| 114: | public function isPrivateSet(): bool { |
| 115: | return (bool) ($this->flags & Modifiers::PRIVATE_SET); |
| 116: | } |
| 117: | |
| 118: | public function getType(): string { |
| 119: | return 'Stmt_Property'; |
| 120: | } |
| 121: | } |
| 122: | |