ParameterBuilder   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 5
dl 0
loc 25
ccs 11
cts 11
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 18 4
1
<?php
2
declare(strict_types=1);
3
4
namespace gossi\codegen\generator\builder;
5
6
use gossi\codegen\generator\builder\parts\TypeBuilderPart;
7
use gossi\codegen\generator\builder\parts\ValueBuilderPart;
8
use gossi\codegen\model\AbstractModel;
9
10
class ParameterBuilder extends AbstractBuilder {
11
12
	use ValueBuilderPart;
13
	use TypeBuilderPart;
14
15 11
	public function build(AbstractModel $model): void {
16 11
		$type = $this->getType($model, $this->config->getGenerateScalarTypeHints(), $this->config->getGenerateNullableTypes());
17 11
		if ($type !== null) {
18 4
			$this->writer->write($type . ' ');
19
		}
20
21 11
		if ($model->isPassedByReference()) {
22 2
			$this->writer->write('&');
23
		}
24
25 11
		$this->writer->write('$' . $model->getName());
26
27 11
		if ($model->hasValue()) {
28 3
			$this->writer->write(' = ');
29
30 3
			$this->writeValue($model);
31
		}
32 11
	}
33
34
}
35