| Total Complexity | 3 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 90.48% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class YamlBuilder |
||
| 11 | { |
||
| 12 | protected $files; |
||
| 13 | |||
| 14 | 54 | public function __construct(Filesystem $files) |
|
| 15 | { |
||
| 16 | 54 | $this->files = $files; |
|
| 17 | 54 | } |
|
| 18 | |||
| 19 | /** |
||
| 20 | * Build the docker-compose.yaml file |
||
| 21 | * |
||
| 22 | * @param $imageSet |
||
| 23 | * @throws \Throwable |
||
| 24 | */ |
||
| 25 | 4 | public function build(ImageRepository $imageSet) |
|
| 26 | { |
||
| 27 | 4 | $lib = app(PorterLibrary::class); |
|
| 28 | |||
| 29 | 4 | $this->files->put( |
|
| 30 | 4 | $lib->dockerComposeFile(), |
|
| 31 | 4 | view("docker_compose.{$imageSet->getName()}.base")->with([ |
|
| 32 | 4 | 'home' => setting('home'), |
|
| 33 | 4 | 'host_machine_name' => setting('host_machine_name'), |
|
| 34 | 4 | 'activePhpVersions' => PhpVersion::active()->get(), |
|
| 35 | 4 | 'useMysql' => setting('use_mysql') == 'on', |
|
| 36 | 4 | 'useRedis' => setting('use_redis') == 'on', |
|
| 37 | 4 | 'useBrowser' => setting('use_browser') == 'on', |
|
| 38 | 4 | 'imageSet' => $imageSet->getName(), |
|
| 39 | 4 | 'imageSetPath' => $imageSet->getPath(), |
|
| 40 | 4 | 'libraryPath' => $lib->path(), |
|
| 41 | 4 | ])->render() |
|
| 42 | ); |
||
| 43 | 4 | } |
|
| 44 | |||
| 45 | /** |
||
| 46 | * Destroy the docker-compose.yaml file |
||
| 47 | */ |
||
| 48 | public function destroy() |
||
| 51 | } |
||
| 52 | } |
||
| 53 |