1: <?php
2:
3: 4: 5: 6:
7:
8: namespace Nette\PhpGenerator;
9:
10: use Nette;
11:
12:
13: 14: 15:
16: abstract class Member
17: {
18: use Nette\SmartObject;
19:
20:
21: private $name;
22:
23:
24: private $visibility;
25:
26:
27: private ;
28:
29:
30: 31: 32:
33: public function __construct($name = '')
34: {
35: $this->setName($name);
36: }
37:
38:
39:
40: public function setName($name)
41: {
42: $this->name = (string) $name;
43: return $this;
44: }
45:
46:
47: 48: 49:
50: public function getName()
51: {
52: return $this->name;
53: }
54:
55:
56: 57: 58: 59:
60: public function setVisibility($val)
61: {
62: if (!in_array($val, ['public', 'protected', 'private', NULL], TRUE)) {
63: throw new Nette\InvalidArgumentException('Argument must be public|protected|private.');
64: }
65: $this->visibility = $val;
66: return $this;
67: }
68:
69:
70: 71: 72:
73: public function getVisibility()
74: {
75: return $this->visibility;
76: }
77:
78:
79: 80: 81: 82:
83: public function ($val)
84: {
85: $this->comment = $val ? (string) $val : NULL;
86: return $this;
87: }
88:
89:
90: 91: 92:
93: public function ()
94: {
95: return $this->comment;
96: }
97:
98:
99: 100: 101: 102:
103: public function ($val)
104: {
105: $this->comment .= $this->comment ? "\n$val" : $val;
106: return $this;
107: }
108:
109:
110:
111: public function setDocuments(array $s)
112: {
113: trigger_error(__METHOD__ . '() is deprecated, use similar setComment()', E_USER_DEPRECATED);
114: return $this->setComment(implode("\n", $s));
115: }
116:
117:
118:
119: public function getDocuments()
120: {
121: trigger_error(__METHOD__ . '() is deprecated, use similar getComment()', E_USER_DEPRECATED);
122: return $this->comment ? [$this->comment] : [];
123: }
124:
125:
126:
127: public function addDocument($s)
128: {
129: trigger_error(__METHOD__ . '() is deprecated, use addComment()', E_USER_DEPRECATED);
130: return $this->addComment($s);
131: }
132:
133: }
134: