PHPClass.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace inter\phpStruct;
  3. class PHPClass
  4. {
  5. private string $className;
  6. /** @var Attr[] */
  7. private array $attrs;
  8. private array $func;
  9. /** @var string[] */
  10. private array $extends;
  11. public function AddAttr(Attr $attr): self
  12. {
  13. $this->attrs[] = $attr;
  14. return $this;
  15. }
  16. /**
  17. * @return Attr[]
  18. */
  19. public function GetAttrs(): array
  20. {
  21. return $this->attrs;
  22. }
  23. public function AddFunc(Func $func): self
  24. {
  25. $this->func[] = $func;
  26. return $this;
  27. }
  28. public function SetClassName(string $className): self
  29. {
  30. $this->className = $className;
  31. return $this;
  32. }
  33. public function GetClassName(): string
  34. {
  35. return $this->className;
  36. }
  37. public function AddExtends(string $val): self
  38. {
  39. $this->extends[] = $val;
  40. return $this;
  41. }
  42. /**
  43. * @return string[]
  44. */
  45. public function GetExtends(): array
  46. {
  47. return $this->extends;
  48. }
  49. public function SetExtends(array $val): self
  50. {
  51. $this->extends = $val;
  52. return $this;
  53. }
  54. }