-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathSetCommand.php
42 lines (35 loc) · 1.1 KB
/
SetCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Liuggio\StatsDClientBundle\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Command to send an set metric to statsd.
*
* @author Pablo Godel <pgodel@gmail.com>
*/
class SetCommand extends BaseCommand
{
protected function configure()
{
parent::configure();
$this
->setName('statsd:set')
->setDescription('Sends a set metric to StatsD')
->addArgument('key', InputArgument::REQUIRED, 'The key')
->addArgument('value', InputArgument::REQUIRED, 'The value')
->setHelp(<<<EOT
The <info>%command.full_name%</info> command sends a set metric to StatsD:
<info>./app/console %command.full_name%</info>
EOT
);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$data = $this->getDataFactory()->set(
$input->getArgument('key'),
$input->getArgument('value')
);
$this->getClientService()->send($data);
}
}