TraitBuilder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 4
dl 0
loc 31
ccs 19
cts 19
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 15 1
A buildSignature() 0 4 1
A sort() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace gossi\codegen\generator\builder;
5
6
use gossi\codegen\generator\builder\parts\StructBuilderPart;
7
use gossi\codegen\model\AbstractModel;
8
use gossi\codegen\model\PhpTrait;
9
10
class TraitBuilder extends AbstractBuilder {
11
12
	use StructBuilderPart;
13
14 1
	public function build(AbstractModel $model): void {
15 1
		$this->sort($model);
16
17 1
		$this->buildHeader($model);
18
19
		// signature
20 1
		$this->buildSignature($model);
21
22
		// body
23 1
		$this->writer->writeln(" {\n")->indent();
24 1
		$this->buildTraits($model);
25 1
		$this->buildProperties($model);
26 1
		$this->buildMethods($model);
27 1
		$this->writer->outdent()->rtrim()->write('}');
28 1
	}
29
30 1
	private function buildSignature(PhpTrait $model) {
31 1
		$this->writer->write('trait ');
32 1
		$this->writer->write($model->getName());
33 1
	}
34
35 1
	private function sort(PhpTrait $model) {
36 1
		$this->sortUseStatements($model);
37 1
		$this->sortProperties($model);
38 1
		$this->sortMethods($model);
39 1
	}
40
}
41