Skip to content

Commit bbc8189

Browse files
committed
added addComment(), setComment() and getComment()
1 parent 6245050 commit bbc8189

File tree

4 files changed

+123
-3
lines changed

4 files changed

+123
-3
lines changed

src/PhpGenerator/ClassType.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,36 @@ public function addTrait($trait)
333333
}
334334

335335

336+
/**
337+
* @param string|NULL
338+
* @return self
339+
*/
340+
public function setComment($val)
341+
{
342+
$this->documents = $val ? array((string) $val) : array();
343+
return $this;
344+
}
345+
346+
347+
/**
348+
* @return string|NULL
349+
*/
350+
public function getComment()
351+
{
352+
return implode($this->documents) ?: NULL;
353+
}
354+
355+
356+
/**
357+
* @param string
358+
* @return self
359+
*/
360+
public function addComment($val)
361+
{
362+
return $this->addDocument($val);
363+
}
364+
365+
336366
/**
337367
* @param string[]
338368
* @return self

src/PhpGenerator/Method.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,36 @@ public function isVariadic()
374374
}
375375

376376

377+
/**
378+
* @param string|NULL
379+
* @return self
380+
*/
381+
public function setComment($val)
382+
{
383+
$this->documents = $val ? array((string) $val) : array();
384+
return $this;
385+
}
386+
387+
388+
/**
389+
* @return string|NULL
390+
*/
391+
public function getComment()
392+
{
393+
return implode($this->documents) ?: NULL;
394+
}
395+
396+
397+
/**
398+
* @param string
399+
* @return self
400+
*/
401+
public function addComment($val)
402+
{
403+
return $this->addDocument($val);
404+
}
405+
406+
377407
/**
378408
* @param string[]
379409
* @return self

src/PhpGenerator/PhpFile.php

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,32 @@ class PhpFile extends Object
2929

3030

3131
/**
32-
* @return string[]
32+
* @param string|NULL
33+
* @return self
3334
*/
34-
public function getDocuments()
35+
public function setComment($val)
3536
{
36-
return $this->documents;
37+
$this->documents = $val ? array((string) $val) : array();
38+
return $this;
39+
}
40+
41+
42+
/**
43+
* @return string|NULL
44+
*/
45+
public function getComment()
46+
{
47+
return implode($this->documents) ?: NULL;
48+
}
49+
50+
51+
/**
52+
* @param string
53+
* @return self
54+
*/
55+
public function addComment($val)
56+
{
57+
return $this->addDocument($val);
3758
}
3859

3960

@@ -48,6 +69,15 @@ public function setDocuments(array $documents)
4869
}
4970

5071

72+
/**
73+
* @return string[]
74+
*/
75+
public function getDocuments()
76+
{
77+
return $this->documents;
78+
}
79+
80+
5181
/**
5282
* @param string
5383
* @return self

src/PhpGenerator/Property.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,36 @@ public function getVisibility()
137137
}
138138

139139

140+
/**
141+
* @param string|NULL
142+
* @return self
143+
*/
144+
public function setComment($val)
145+
{
146+
$this->documents = $val ? array((string) $val) : array();
147+
return $this;
148+
}
149+
150+
151+
/**
152+
* @return string|NULL
153+
*/
154+
public function getComment()
155+
{
156+
return implode($this->documents) ?: NULL;
157+
}
158+
159+
160+
/**
161+
* @param string
162+
* @return self
163+
*/
164+
public function addComment($val)
165+
{
166+
return $this->addDocument($val);
167+
}
168+
169+
140170
/**
141171
* @param string[]
142172
* @return self

0 commit comments

Comments
 (0)