1 | <?php declare(strict_types=1); |
||
13 | class FunctionGenerator extends AbstractGenerator |
||
14 | { |
||
15 | use CodeTrait; |
||
16 | |||
17 | /** @var string Function name */ |
||
18 | protected $name; |
||
19 | |||
20 | /** @var array Collection of function arguments */ |
||
21 | protected $arguments = []; |
||
22 | |||
23 | /** @var array Collection of function arguments descriptions */ |
||
24 | protected $argumentDescriptions = []; |
||
25 | |||
26 | /** @var array Collection of function arguments default values */ |
||
27 | protected $argumentDefaults = []; |
||
28 | |||
29 | /** @var string Return type hint */ |
||
30 | protected $returnType; |
||
31 | |||
32 | /** @var FunctionCommentsGenerator */ |
||
33 | protected $commentGenerator; |
||
34 | |||
35 | /** |
||
36 | * FunctionGenerator constructor. |
||
37 | * |
||
38 | * @param string $name Function name |
||
39 | * @param AbstractGenerator $parent Parent Generator |
||
40 | */ |
||
41 | 20 | public function __construct(string $name, AbstractGenerator $parent = null) |
|
50 | |||
51 | /** |
||
52 | * Set function argument. |
||
53 | * |
||
54 | * @param string $name Argument name |
||
55 | * @param string|null $type Argument type |
||
56 | * @param string $description Argument description |
||
57 | * @param mixed $defaultValue Argument default value |
||
58 | * |
||
59 | * @return FunctionGenerator |
||
60 | */ |
||
61 | 8 | public function defArgument(string $name, string $type = null, string $description = null, $defaultValue = null) : FunctionGenerator |
|
71 | |||
72 | /** |
||
73 | * @inheritdoc |
||
74 | */ |
||
75 | 6 | public function setIndentation(int $indentation): AbstractGenerator |
|
82 | |||
83 | /** |
||
84 | * Set function description comment. |
||
85 | * |
||
86 | * @param array $description Function description |
||
87 | * |
||
88 | * @return FunctionGenerator |
||
89 | */ |
||
90 | public function defDescription(array $description): FunctionGenerator |
||
102 | |||
103 | /** |
||
104 | * Set return value type |
||
105 | * |
||
106 | * @param string|null $type Return type hint |
||
107 | * |
||
108 | * @return FunctionGenerator |
||
109 | */ |
||
110 | 1 | public function defReturnType(string $type) : FunctionGenerator |
|
116 | |||
117 | /** |
||
118 | * {@inheritdoc} |
||
119 | */ |
||
120 | 15 | public function code(int $indentation = 0) : string |
|
148 | |||
149 | /** |
||
150 | * Build function definition. |
||
151 | * |
||
152 | * @return string Function definition |
||
153 | */ |
||
154 | 5 | protected function buildDefinition() |
|
158 | |||
159 | /** |
||
160 | * {@inheritdoc} |
||
161 | */ |
||
162 | 7 | public function defComment() : CommentsGenerator |
|
166 | } |
||
167 |
This class, trait or interface has been deprecated.