芝麻web文件管理V1.00
编辑当前文件:/home/seolotod/critterchoice.com/wp-content/mu-plugins/object-cache-pro/src/Metrics/Measurement.php
id = substr(md5(uniqid((string) mt_rand(), true)), 12); $self->timestamp = microtime(true); $self->hostname = gethostname() ?: null; $self->path = $_SERVER['REQUEST_URI'] ?? null; if (isset($_ENV['DYNO'])) { $self->hostname = $_ENV['DYNO']; // Heroku } return $self; } /** * Returns an rfc3339 compatible timestamp. * * @return string */ public function rfc3339() { return substr_replace( date('c', intval($this->timestamp)), substr((string) fmod($this->timestamp, 1), 1, 7), 19, 0 ); } /** * Returns the measurement as array. * * @return array
*/ public function toArray() { $array = $this->wp->toArray(); if ($this->redis) { $redis = $this->redis->toArray(); $array += array_combine(array_map(static function ($key) { return "redis-{$key}"; }, array_keys($redis)), $redis); } if ($this->relay) { $relay = $this->relay->toArray(); $array += array_combine(array_map(static function ($key) { return "relay-{$key}"; }, array_keys($relay)), $relay); } return $array; } /** * Returns the request metrics in string format. * * @return string */ public function __toString() { return implode(' ', array_filter([ $this->wp, $this->redis ? (string) $this->redis : null, $this->relay ? (string) $this->relay : null, ])); } /** * Helper method to access metrics. * * @param string $name * @return mixed */ public function __get(string $name) { if (strpos($name, '->') !== false) { [$type, $metric] = explode('->', $name); if (strpos($metric, '-') !== false) { $metric = lcfirst(str_replace('-', '', ucwords($metric, '-'))); } if (property_exists($this, $type)) { return $this->{$type}->{$metric} ?? null; } } trigger_error( sprintf('Undefined property: %s::$%s', get_called_class(), $name), E_USER_WARNING ); } }