91291aa126947a951a44529184d612121acf570f
[yaffs-website] / vendor / nikic / php-parser / lib / PhpParser / Node / Stmt / Property.php
1 <?php declare(strict_types=1);
2
3 namespace PhpParser\Node\Stmt;
4
5 use PhpParser\Node;
6
7 class Property extends Node\Stmt
8 {
9     /** @var int Modifiers */
10     public $flags;
11     /** @var PropertyProperty[] Properties */
12     public $props;
13
14     /**
15      * Constructs a class property list node.
16      *
17      * @param int                $flags      Modifiers
18      * @param PropertyProperty[] $props      Properties
19      * @param array              $attributes Additional attributes
20      */
21     public function __construct(int $flags, array $props, array $attributes = []) {
22         parent::__construct($attributes);
23         $this->flags = $flags;
24         $this->props = $props;
25     }
26
27     public function getSubNodeNames() : array {
28         return ['flags', 'props'];
29     }
30
31     /**
32      * Whether the property is explicitly or implicitly public.
33      *
34      * @return bool
35      */
36     public function isPublic() : bool {
37         return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
38             || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
39     }
40
41     /**
42      * Whether the property is protected.
43      *
44      * @return bool
45      */
46     public function isProtected() : bool {
47         return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
48     }
49
50     /**
51      * Whether the property is private.
52      *
53      * @return bool
54      */
55     public function isPrivate() : bool {
56         return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
57     }
58
59     /**
60      * Whether the property is static.
61      *
62      * @return bool
63      */
64     public function isStatic() : bool {
65         return (bool) ($this->flags & Class_::MODIFIER_STATIC);
66     }
67     
68     public function getType() : string {
69         return 'Stmt_Property';
70     }
71 }