Mercurial > hg > cmmr2012-drupal-site
annotate vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php declare(strict_types=1); |
Chris@0 | 2 |
Chris@0 | 3 namespace PhpParser\Node\Stmt; |
Chris@0 | 4 |
Chris@0 | 5 use PhpParser\Node; |
Chris@0 | 6 |
Chris@0 | 7 class ClassConst extends Node\Stmt |
Chris@0 | 8 { |
Chris@0 | 9 /** @var int Modifiers */ |
Chris@0 | 10 public $flags; |
Chris@0 | 11 /** @var Node\Const_[] Constant declarations */ |
Chris@0 | 12 public $consts; |
Chris@0 | 13 |
Chris@0 | 14 /** |
Chris@0 | 15 * Constructs a class const list node. |
Chris@0 | 16 * |
Chris@0 | 17 * @param Node\Const_[] $consts Constant declarations |
Chris@0 | 18 * @param int $flags Modifiers |
Chris@0 | 19 * @param array $attributes Additional attributes |
Chris@0 | 20 */ |
Chris@0 | 21 public function __construct(array $consts, int $flags = 0, array $attributes = []) { |
Chris@0 | 22 parent::__construct($attributes); |
Chris@0 | 23 $this->flags = $flags; |
Chris@0 | 24 $this->consts = $consts; |
Chris@0 | 25 } |
Chris@0 | 26 |
Chris@0 | 27 public function getSubNodeNames() : array { |
Chris@0 | 28 return ['flags', 'consts']; |
Chris@0 | 29 } |
Chris@0 | 30 |
Chris@0 | 31 /** |
Chris@0 | 32 * Whether constant is explicitly or implicitly public. |
Chris@0 | 33 * |
Chris@0 | 34 * @return bool |
Chris@0 | 35 */ |
Chris@0 | 36 public function isPublic() : bool { |
Chris@0 | 37 return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 |
Chris@0 | 38 || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; |
Chris@0 | 39 } |
Chris@0 | 40 |
Chris@0 | 41 /** |
Chris@0 | 42 * Whether constant is protected. |
Chris@0 | 43 * |
Chris@0 | 44 * @return bool |
Chris@0 | 45 */ |
Chris@0 | 46 public function isProtected() : bool { |
Chris@0 | 47 return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); |
Chris@0 | 48 } |
Chris@0 | 49 |
Chris@0 | 50 /** |
Chris@0 | 51 * Whether constant is private. |
Chris@0 | 52 * |
Chris@0 | 53 * @return bool |
Chris@0 | 54 */ |
Chris@0 | 55 public function isPrivate() : bool { |
Chris@0 | 56 return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); |
Chris@0 | 57 } |
Chris@0 | 58 |
Chris@0 | 59 public function getType() : string { |
Chris@0 | 60 return 'Stmt_ClassConst'; |
Chris@0 | 61 } |
Chris@0 | 62 } |