PropertyBuilder::build()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 10
cts 10
cp 1
rs 9.7998
c 0
b 0
f 0
cc 3
nc 2
nop 1
crap 3
1
<?php
2
declare(strict_types=1);
3
4
namespace gossi\codegen\generator\builder;
5
6
use gossi\codegen\generator\builder\parts\ValueBuilderPart;
7
use gossi\codegen\model\AbstractModel;
8
9
class PropertyBuilder extends AbstractBuilder {
10
11
	use ValueBuilderPart;
12
13 8
	public function build(AbstractModel $model): void {
14 8
		$this->buildDocblock($model);
15
16 8
		$this->writer->write($model->getVisibility() . ' ');
17 8
		$this->writer->write($model->isStatic() ? 'static ' : '');
18 8
		$this->writer->write('$' . $model->getName());
19
20 8
		if ($model->hasValue()) {
21 3
			$this->writer->write(' = ');
22 3
			$this->writeValue($model);
23
		}
24
25 8
		$this->writer->writeln(';');
26 8
	}
27
28
}
29