Skip to content

Instantly share code, notes, and snippets.

@mageekguy
Created October 30, 2014 13:45
Show Gist options
  • Save mageekguy/aa27a6370ba403b153df to your computer and use it in GitHub Desktop.
Save mageekguy/aa27a6370ba403b153df to your computer and use it in GitHub Desktop.
function add(statsd\metric $metric, callable $callback)
{
$packet = clone $this;
$callback($packet->addMetric($metric));
return $this;
}
function adds(array $metrics, callable $callback)
{
$packet = clone $this;
foreach ($metrics as $metric)
{
$packet->addMetric($metric);
}
$callback($packet);
return $this;
}
private function addMetric(statsd\metric $metric)
{
array_unshift($this->metrics, $metric);
return $this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment