function __construct($config) { parent::__construct(); $this->id = uniqid(); // multiple consumers support $this->consumerTimers = array(); // for interval sampling probes $this->disableDelay = null; if (gettype($config) === 'string') { $config = array('name' => $config, 'types' => array_slice(func_get_args(), 1)); } $this->name = $config['name']; if (array_key_exists('types', $config) && count($config['types']) > 0) { $this->types = $config['types']; } else { $this->types = array('number'); } $this->enabled = isset($config['enabled']) ? $config['enabled'] : false; $this->instant = isset($config['instant']) ? $config['instant'] : false; $this->sampleThreshold = isset($config['sampleThreshold']) ? $config['sampleThreshold'] : 1000; if (isset($config['args'])) { if (gettype($config['args'] === 'array')) { $this->args = $config['args']; } else { $this->args = array($config['args']); } if (gettype($this->args) === 'array' && count($this->args) === 1 && gettype($this->args[0]) === 'function reference') { $this->args = $this->args[0]; } } else { $this->args = array_map(function ($type) { return $type === 'number' ? 0 : ''; }, $this->types); } $this->hits = 0; }
public function notify($eventName, array $params = array()) { return parent::notify($eventName, $params); }