Jimdo/prometheus_client_php

View on GitHub
src/Prometheus/Sample.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace Prometheus;


class Sample
{
    private $name;
    private $labelNames;
    private $labelValues;
    private $value;

    public function __construct(array $data)
    {
        $this->name = $data['name'];
        $this->labelNames = $data['labelNames'];
        $this->labelValues = $data['labelValues'];
        $this->value = $data['value'];
    }

    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @return array
     */
    public function getLabelNames()
    {
        return (array)$this->labelNames;
    }

    /**
     * @return array
     */
    public function getLabelValues()
    {
        return (array)$this->labelValues;
    }

    /**
     * @return int|double
     */
    public function getValue()
    {
        return $this->value;
    }

    /**
     * @return bool
     */
    public function hasLabelNames()
    {
        return !empty($this->labelNames);
    }
}