Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
Es6CodeGenerator
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 create
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\TypescriptClientBuilder\CodeGenerators;
3
4use Apie\Core\BoundedContext\BoundedContextHashmap;
5
6class Es6CodeGenerator
7{
8    public function __construct(
9        private readonly EntityListFactory $entityListFactory,
10    ) {
11    }
12
13    public function create(BoundedContextHashmap $boundedContextHashmap, string $apiEndpoint): string
14    {
15        return "import { createForApi } from './index';
16const apiUrl = " . json_encode($apiEndpoint) . ";
17const resourceDefinition = " . json_encode($this->entityListFactory->createTodolistPerBoundedContext($boundedContextHashmap), JSON_PRETTY_PRINT) . ";
18export const ApieLayer = createForApi(apiUrl, resourceDefinition);
19";
20
21    }
22}