forked from phpowermove/php-code-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodBuilder.php
More file actions
40 lines (27 loc) · 826 Bytes
/
MethodBuilder.php
File metadata and controls
40 lines (27 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace gossi\codegen\generator\builder;
use gossi\codegen\generator\builder\parts\RoutineBuilderPart;
use gossi\codegen\model\AbstractModel;
use gossi\codegen\model\PhpInterface;
class MethodBuilder extends AbstractBuilder {
use RoutineBuilderPart;
public function build(AbstractModel $model) {
$this->buildDocblock($model);
if ($model->isFinal()) {
$this->writer->write('final ');
}
if ($model->isAbstract()) {
$this->writer->write('abstract ');
}
$this->writer->write($model->getVisibility() . ' ');
if ($model->isStatic()) {
$this->writer->write('static ');
}
$this->writeFunctionStatement($model);
if ($model->isAbstract() || $model->getParent() instanceof PhpInterface) {
$this->writer->writeln(';');
return;
}
$this->writeBody($model);
}
}