30 lines
538 B
PHP
30 lines
538 B
PHP
<?php
|
|
|
|
class Prometheus
|
|
{
|
|
private array $data = [];
|
|
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
public function add(string $name, string|int|float $value): self
|
|
{
|
|
$this->data[$name] = $value;
|
|
return $this;
|
|
}
|
|
|
|
public function getData(): string
|
|
{
|
|
$result = '';
|
|
foreach ($this->data as $key => $value) {
|
|
$result .= $key . ': ' . $value . PHP_EOL;
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
public function showData(): void
|
|
{
|
|
echo $this->getData();
|
|
}
|
|
} |