public function mk($key, $value, $ttl = 0) { $body = $request = $this->set($key, $value, $ttl, array('prevExist' => 'false')); if (isset($body['errorCode'])) { throw new KeyExistsException($body['message'], $body['errorCode']); } return $body; }
public function execute(InputInterface $input, OutputInterface $output) { $server = $input->getArgument('server'); $key = $input->getArgument('key'); $value = $input->getArgument('value'); $output->writeln("<info>Create `{$key}` with `{$value}`</info>"); $client = new EtcdClient($server); $data = $client->mk($key, $value); $json = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); echo $json; }