You are here

public function OpCacheDataModel::getStatusDataRows in Production check & Production monitor 7

Same name and namespace in other branches
  1. 6 includes/prod_check.opcache.inc \OpCacheDataModel::getStatusDataRows()

File

includes/prod_check.opcache.inc, line 31

Class

OpCacheDataModel

Code

public function getStatusDataRows() {
  $rows = array();
  foreach ($this->_status as $key => $value) {
    if ($key === 'scripts') {
      continue;
    }
    if (is_array($value)) {
      foreach ($value as $k => $v) {
        if ($v === false) {
          $value = 'false';
        }
        if ($v === true) {
          $value = 'true';
        }
        if ($k === 'used_memory' || $k === 'free_memory' || $k === 'wasted_memory') {
          $v = $this
            ->_size_for_humans($v);
        }
        if ($k === 'current_wasted_percentage' || $k === 'opcache_hit_rate') {
          $v = number_format($v, 2) . '%';
        }
        if ($k === 'blacklist_miss_ratio') {
          $v = number_format($v, 2) . '%';
        }
        if ($k === 'start_time' || $k === 'last_restart_time') {
          $v = $v ? date(DATE_RFC822, $v) : 'never';
        }
        if (THOUSAND_SEPARATOR === true && is_int($v)) {
          $v = number_format($v);
        }
        $rows[] = "<tr><th>{$k}</th><td>{$v}</td></tr>\n";
      }
      continue;
    }
    if ($value === false) {
      $value = 'false';
    }
    if ($value === true) {
      $value = 'true';
    }
    $rows[] = "<tr><th>{$key}</th><td>{$value}</td></tr>\n";
  }
  return implode("\n", $rows);
}