From e9f157ec5ccdfae73b4c9e82c9ae7c37bcfa1513 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 3 Dec 2018 23:39:50 +0100 Subject: Renderer: Added shared data --- src/Controllers/Metrics/MetricsEngine.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/Controllers/Metrics/MetricsEngine.php') diff --git a/src/Controllers/Metrics/MetricsEngine.php b/src/Controllers/Metrics/MetricsEngine.php index 1e0f6957..21ae8fd0 100644 --- a/src/Controllers/Metrics/MetricsEngine.php +++ b/src/Controllers/Metrics/MetricsEngine.php @@ -9,13 +9,13 @@ class MetricsEngine implements EngineInterface /** * Render metrics * - * @example $data = ['foo' => [['labels' => ['foo'=>'bar'], 'value'=>42]], 'bar'=>123] - * * @param string $path * @param mixed[] $data * @return string + * + * @example $data = ['foo' => [['labels' => ['foo'=>'bar'], 'value'=>42]], 'bar'=>123] */ - public function get($path, $data = []): string + public function get(string $path, array $data = []): string { $return = []; foreach ($data as $name => $list) { @@ -52,7 +52,7 @@ class MetricsEngine implements EngineInterface * @param string $path * @return bool */ - public function canRender($path): bool + public function canRender(string $path): bool { return $path == '/metrics'; } @@ -60,8 +60,8 @@ class MetricsEngine implements EngineInterface /** * @param string $name * @param array|mixed $row - * @see https://prometheus.io/docs/instrumenting/exposition_formats/ * @return string + * @see https://prometheus.io/docs/instrumenting/exposition_formats/ */ protected function formatData($name, $row): string { @@ -135,4 +135,12 @@ class MetricsEngine implements EngineInterface $value ); } + + /** + * Does nothing as shared data will onyly result in unexpected behaviour + * + * @param string|mixed[] $key + * @param mixed $value + */ + public function share($key, $value = null) { } } -- cgit v1.2.3-54-g00ecf