File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
src/phpDocumentor/Reflection Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -229,6 +229,29 @@ protected function parseTags($tags)
229
229
$ this ->tags = $ result ;
230
230
}
231
231
232
+ public function getDescription (){
233
+ $ short = $ this ->getShortDescription ();
234
+ $ long = $ this ->getLongDescription ()->getContents ();
235
+
236
+ if ($ long ){
237
+ return $ short . "\n" . $ long ;
238
+ }else {
239
+ return $ short ;
240
+ }
241
+ }
242
+
243
+ /**
244
+ * Set the short and long description.
245
+ *
246
+ * @param $docblock
247
+ * @return $this
248
+ */
249
+ public function setDescription ($ docblock ){
250
+ list ($ short , $ long ) = $ this ->splitDocBlock ($ docblock );
251
+ $ this ->short_description = $ short ;
252
+ $ this ->long_description = new DocBlock \Description ($ long , $ this );
253
+ return $ this ;
254
+ }
232
255
/**
233
256
* Returns the opening line or also known as short description.
234
257
*
@@ -348,6 +371,27 @@ public function appendTag(Tag $tag)
348
371
return $ tag ;
349
372
}
350
373
374
+ /**
375
+ * Generate a DocBlock Comment
376
+ *
377
+ * @return string
378
+ */
379
+ public function getDocComment ($ indentation = '' ){
380
+
381
+ $ description = str_replace ("\n" , "\n$ indentation * " , $ this ->getDescription ());
382
+
383
+ $ comment = "$ indentation/** \n$ indentation * $ description \n$ indentation * \n" ;
384
+
385
+ /** @var Tag $tag */
386
+ foreach ($ this ->getTags () as $ tag ) {
387
+ $ comment .= $ indentation .' * @ ' . $ tag ->getName () . " " . $ tag ->getContent () . "\n" ;
388
+ }
389
+
390
+ $ comment .= $ indentation .' */ ' ;
391
+
392
+ return $ comment ;
393
+ }
394
+
351
395
/**
352
396
* Builds a string representation of this object.
353
397
*
You can’t perform that action at this time.
0 commit comments