Total Complexity | 2 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 88.24% |
Changes | 0 |
1 | <?php |
||
8 | class YamlBuilder |
||
9 | { |
||
10 | /** |
||
11 | * Build the docker-compose.yaml file |
||
12 | * |
||
13 | * @param $imageSet |
||
14 | * @throws \Throwable |
||
15 | */ |
||
16 | 4 | public function build(ImageRepository $imageSet) |
|
17 | { |
||
18 | 4 | file_put_contents( |
|
19 | 4 | config('porter.docker-compose-file'), |
|
20 | 4 | view("docker_compose.{$imageSet->getName()}.base")->with([ |
|
21 | 4 | 'home' => setting('home'), |
|
22 | 4 | 'host_machine_name' => setting('host_machine_name'), |
|
23 | 4 | 'activePhpVersions' => PhpVersion::active()->get(), |
|
24 | 4 | 'useMysql' => setting('use_mysql') == 'on', |
|
25 | 4 | 'useRedis' => setting('use_redis') == 'on', |
|
26 | 4 | 'useBrowser' => setting('use_browser') == 'on', |
|
27 | 4 | 'imageSet' => $imageSet->getName(), |
|
28 | 4 | 'imageSetPath' => $imageSet->getPath(), |
|
29 | 4 | 'libraryPath' => config('porter.library_path'), |
|
30 | 4 | ])->render() |
|
31 | ); |
||
32 | 4 | } |
|
33 | |||
34 | /** |
||
35 | * Destroy the docker-compose.yaml file |
||
36 | */ |
||
37 | public function destroy() |
||
40 | } |
||
41 | } |
||
42 |
If you suppress an error, we recommend checking for the error condition explicitly: