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

MapOutputBuilder::buildMapHtml()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 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