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