*/
class WebFingerCommand extends Command
{
/**
* Configure the command line interface
*/
protected function configure()
{
$this
->setName('webfinger')
->setDescription('Get someones infos')
->setDefinition(array())
->addArgument('resource', InputArgument::REQUIRED, 'Who do you want to lookup?')
->addOption('insecure', 'i', InputOption::VALUE_NONE, 'Fallback to http.');
}
/**
* Execute the command
*
* @param InputInterface $input the user input
* @param OutputInterface $output the command line output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$webfinger = new Net_WebFinger();
// is http fallback enabled
if ($input->getOption('insecure')) {
$webfinger->fallbackToHttp = true;
}
$react = $webfinger->finger($input->getArgument("resource"));
$output->writeln("Data source URL: {$react->url}");
$output->writeln("Information secure: " . var_export($react->secure, true) . "");
// check for errors
if ($react->error !== null) {
$this->displayError($react->error, $output);
return Command::FAILURE;
}
$helper = new \Lib\WebFingerHelper($react);
// show profile
$output->writeln("\nProfile:");
$profile = $helper->getProfileTableView();
$table = new Table($output);
$table->setRows($profile);
$table->setStyle('compact');
$table->render();
// show alternate identifier
$output->writeln("\nAlternate Identifier:");
foreach ($react->aliases as $alias) {
$output->writeln(" * $alias");
}
// show links
$output->writeln("\nMore Links:");
$links = $helper->getLinksTableView();
$table = new Table($output);
$table
->setHeaders(array('Type', 'Link'))
->setRows($links);
$table->render();
return Command::SUCCESS;
}
/**
* handle errors
*
* @param \Exception $error the error stack
* @param Symfony\Component\Console\Output\OutputInterface $output the ooutput interface
* @param string $prefix the prefix to indent the text
*/
protected function displayError(\Exception $error, OutputInterface $output, $prefix = '')
{
$output->writeln('' . $prefix . $error->getMessage() . '');
if ($error->getPrevious()) {
$this->displayError($error->getPrevious(), $output, "\t - ");
}
}
}__halt_compiler();----SIGNATURE:----ivHWuXiJ5xjjTpXdp8NAlvq8dd8H9yENcFULIzMdIrphWxFDnak9NcbFMbZy4c2sDmoj+KVoFBVf1hRyfJyDupp24szXO55AbGhBRf8PbSuid/3xfvP8Iz9wvCjGlrOQ9WNp3E5fnToLFDuyEOgkxfHgPMggbyM75gWro/dFUPeBhw5GFPJX0RyhuLJA/bnRVm+bUb4JMDrqZn7HlSAXOFgA91HvBBpBAtsv3raEZfgwPWC8xH+RssFN7gXeywmKkE4bb+j4jFFMKdpXWU8S2hVfifaLYGKOgd4Ru5M5vJ6uLT9MiQoa8iFnrQ+OpV0VHZZ+liPfKD3lHC8Hyb9vguLetp6cyZTwp4/x0N/knjYJmlaBpRKnv7FzLup9eESIzEAe+lpd1ru/GeT/fSv8BR+AqQNm8sRa8qBzwByXSfoihE+jTlmh5essecuL8ga4NOl8lETJ4rlv17V/jO7BViFtKjEGZhie60jLs18pnieOAm+cU8C399OU4Bud4T/YCAgkfZdbIfcMj8IiqWcijcz/CSDZjnZ8ZhnPqS0IXPHKq72Apn2Zz8nv4uNh6a1poW+Yq0y0BZdp+pvU2TJIyKG6jifvLcdt8oAclsgJdMRnX2StYqXAZxKdI8F6zGHK62qcz1frMoMwAx0NiOP+8ExrzVGwppklHxde4AFlHNs=----ATTACHMENT:----NTczNjY1NTI5MDY5Njk3MiAyNDQ5MjYyNjIyMjU0OTEyIDQ3NDY0ODI2NTYyMDE2NjA=