/** * Bundles up some useful properties of the statistic for convenience. * * @return array */ public function toArray() { $name = $this->name(); $value = $this->computeValue(); $delta = $this->computeDelta(); return ['name' => $name, 'key' => $this->key(), 'granularity' => $this->granularity(), 'prefix' => $this->prefix(), 'suffix' => $this->suffix(), 'hasChart' => $this->hasChart(), 'span' => $this->span(), 'value' => $value, 'abbreviated_value' => is_numeric($value) ? U::number_abbreviate(round($value, 2), 1) : $value, 'delta' => $delta, 'abbreviated_delta' => is_numeric($delta) ? U::number_abbreviate(round($delta, 2), 1) : $delta]; }