php-spark/plugins/com.noccy.docker/DockerCompose/Service.php

37 lines
721 B
PHP

<?php
namespace SparkPlug\Com\Noccy\Docker\DockerCompose;
class Service
{
private array $service;
private array $environment = [];
private Stack|null $stack;
public function __construct(array $service, ?Stack $stack)
{
$this->service = $service;
$this->stack = $stack;
foreach ($this->service['environment']??[] as $k=>$v) {
if (is_numeric($k)) {
[$k, $v] = explode("=", $v, 2);
}
$this->environment[$k] = $v;
}
}
public function getImage():?String
{
return $this->service['image']??null;
}
public function getEnvironment(): array
{
return $this->environment;
}
}