Completed
Push — master ( 4d0076...81538e )
by Jeroen De
26s queued 11s
created

MapOutputBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildOutput() 0 7 1
A buildMapHtml() 0 9 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace Maps\Map;
6
7
use Maps\MappingService;
8
9
class MapOutputBuilder {
10
11 29
	public function buildOutput( MappingService $service, MapData $mapData ): MapOutput {
12 29
		return new MapOutput(
13 29
			$this->buildMapHtml( $service, $mapData ),
14 29
			$service->getResourceModules( $mapData->getParameters() ),
15 29
			$service->getDependencyHtml( $mapData->getParameters() )
16
		);
17
	}
18
19 29
	private function buildMapHtml( MappingService $service, MapData $mapData ): string {
20 29
		$htmlBuilder = new MapHtmlBuilder();
21
22 29
		return $htmlBuilder->getMapHTML(
23 29
			( new MapDataSerializer() )->toJson( $mapData ),
24 29
			$service->newMapId(),
25 29
			$service->getName()
26
		);
27
	}
28
29
}
30