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 | /** |
||
27 | * FunctionGenerator constructor. |
||
28 | * |
||
29 | * @param GenericGenerator $parent Parent Generator |
||
30 | * @param string $name Function name |
||
31 | */ |
||
32 | public function __construct(string $name, GenericGenerator $parent = null) |
||
38 | |||
39 | /** |
||
40 | * Set function argument. |
||
41 | * |
||
42 | * @param string $name Argument name |
||
43 | * @param string|null $type Argument type |
||
44 | * @param string $description Argument description |
||
45 | * |
||
46 | * @return FunctionGenerator |
||
47 | */ |
||
48 | public function defArgument(string $name, string $type = null, string $description = null) : FunctionGenerator |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function code(int $indentation = 0) : string |
||
77 | |||
78 | /** |
||
79 | * Build function definition. |
||
80 | * |
||
81 | * @return string Function definition |
||
82 | */ |
||
83 | protected function buildDefinition() |
||
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | public function defComment() : CommentsGenerator |
||
95 | } |
||
96 |