*/
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:----NyXCS1OTZyNBqR8ch6TnhET985xYir2bLWvr2s21cfmyydNKCwcDsf1iYGzbuG+8pmKTM6jAZqS2TDuW08peysRWP/I0mpi1nCML7p0P5cTbjBtcpTYOtZeO1wMRasoIZ+mjGxny9pmB17asraWbal6AJEwwsTDvOHt/J60SScZTZ1usIxADhbuNCHUtiGjT+4S3BKHGW+oBOgdHySWcmDgtPKHaa4ms/QtRifYTvmkYaiVx6bC8cBPflaJXsO7nTsnG87qnfVmoSZOy+GrIIIXVUQdqmBnu5+LDVceLucwlJD7qEm7Heam+UMTGIGMYcIaO8h9e99d7Sv1aobymWCCEvEFnZGMiCIneiBEn4TnRhyH4H+Osp7TQVzWlgMrrN3WK7dW/t4E1ixpip6VavBZm+aOtvLR9echtCjL0Z6DcT92wNWupC2xaOUKOMGC7Lh+eVCLdC3U7Tb4igPs7mf7HWCSIOJw1iXY6RF0fepY+BagCukOgXnbDSEG+KLGsTGzPVaa0oU8PZR+em1ROwuWxuzQoGoY7YwqGOMn8Cr7S3vszEPlvRJYA9ikbvmY56yThApXpt9al762Gj2Hr6oBFPTejUSt2zP6hJx8PJuf5/tBUn78Idh5vWgf85WjklVT7e2Qv2wCrY5morDdj3jyHsrINCljQQbKW5myx8v8=----ATTACHMENT:----MzExNDU2OTc3MjQyNTU1OSA1NDA2NTgzODE2NDM1MzYzIDU0MTA5NjAxMjI4NTg4MTQ=