菜谱项目

ClassConst.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node;
  4. class ClassConst extends Node\Stmt
  5. {
  6. /** @var int Modifiers */
  7. public $flags;
  8. /** @var Node\Const_[] Constant declarations */
  9. public $consts;
  10. /**
  11. * Constructs a class const list node.
  12. *
  13. * @param Node\Const_[] $consts Constant declarations
  14. * @param int $flags Modifiers
  15. * @param array $attributes Additional attributes
  16. */
  17. public function __construct(array $consts, $flags = 0, array $attributes = array()) {
  18. parent::__construct($attributes);
  19. $this->flags = $flags;
  20. $this->consts = $consts;
  21. }
  22. public function getSubNodeNames() {
  23. return array('flags', 'consts');
  24. }
  25. public function isPublic() {
  26. return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
  27. || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
  28. }
  29. public function isProtected() {
  30. return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
  31. }
  32. public function isPrivate() {
  33. return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
  34. }
  35. public function isStatic() {
  36. return (bool) ($this->flags & Class_::MODIFIER_STATIC);
  37. }
  38. }