1 | <?php declare(strict_types=1); |
||
35 | use AbstractPart; |
||
36 | use BodyPart; |
||
37 | use FinalPart; |
||
38 | use ParametersPart; |
||
39 | use ReferenceReturnPart; |
||
40 | use TypeDocblockGeneratorPart; |
||
41 | |||
42 | /** |
||
43 | * Creates a new PHP method. |
||
44 | * |
||
45 | * @param string $name the method name |
||
46 | */ |
||
47 | public static function create(string $name): static { |
||
|
|||
48 | return new static($name); |
||
49 | 20 | } |
|
50 | 20 | ||
51 | public function __construct(string $name) { |
||
52 | parent::__construct($name); |
||
53 | 34 | $this->initParameters(); |
|
54 | 34 | } |
|
55 | 34 | ||
56 | 34 | /** |
|
57 | * Generates docblock based on provided information |
||
58 | */ |
||
59 | public function generateDocblock(): void { |
||
60 | $docblock = $this->getDocblock(); |
||
61 | 9 | $docblock->setShortDescription($this->getDescription()); |
|
62 | 9 | $docblock->setLongDescription($this->getLongDescription()); |
|
63 | 9 | ||
64 | 9 | // return tag |
|
65 | $this->generateTypeTag(new ReturnTag()); |
||
66 | |||
67 | 9 | // param tags |
|
68 | $this->generateParamDocblock(); |
||
69 | } |
||
70 | } |
||
71 |