| 1 | <?php |
||
| 15 | trait CommentTrait |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var DocComment |
||
| 19 | */ |
||
| 20 | private $docComment = null; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Get associated file comment. |
||
| 24 | * |
||
| 25 | * @return DocComment |
||
| 26 | */ |
||
| 27 | public function getComment(): DocComment |
||
| 28 | { |
||
| 29 | return $this->docComment; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Set comment value. |
||
| 34 | * |
||
| 35 | * @param string|array $comment |
||
| 36 | * |
||
| 37 | * @return $this |
||
| 38 | */ |
||
| 39 | public function setComment($comment) |
||
| 40 | { |
||
| 41 | if (!empty($comment)) { |
||
| 42 | if (is_array($comment)) { |
||
| 43 | $this->docComment->setLines($comment); |
||
| 44 | } elseif (is_string($comment)) { |
||
| 45 | $this->docComment->setString($comment); |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | return $this; |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Init comment value. |
||
| 54 | * |
||
| 55 | * @param string|array $comment |
||
| 56 | */ |
||
| 57 | private function initComment($comment) |
||
| 65 | } |