<?php
namespace nur\tools\compctl;

use nur\msg;
use nur\yaml;

class DockerComposeFile {
  function sync(ConfigFile $config, string $branch, bool $inplace=false): bool {
    if ($inplace) return false;
    [$deps, $isUrls, $notFoundUrls,
    ] = $config->getDeps($branch);
    if ($deps !== null) {
      $volumes = [];
      foreach ($deps as $dep) {
        $volumes[] = "$dep[url]:/var/www/$dep[projname]";
      }
      msg::info("A reporter dans docker-composer.yml");
      yaml::dump([
        "services" => [
          "web" => [
            "volumes" => $volumes,
          ],
        ],
      ]);
    }
    return false;
  }
}