*/
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:----lMVHDPY1IfjbPss6kZoLAY+opiCbL4Spz3qnsfNbTbROpXItg7SstOj5WA1hEZNJfDLNo3JTCZyedKYs8SGVlhIYd4rLJ/A+aMjBjazEbssNV9JTgJjBY23acX6M2waKRTTmo/U4w0F4OSl/EnmJEO40vfuFkx9M/218++NKbMoiPq1YGfC2epBIsrRZTUfIxKgbYELoLicTYCzEUJQBXnIkoHN/uQEMcbDH1XlbxrlieBIHmOjJJBEQwTitt3p8S1Ss5HGVlyCY4lcTy2pc1szM3NzddtZZPe1TsLhS/fix89rL7gG0fVL3CmVY5/qT11PoWR5j1HlkAsn1qrYU21E/ie0e+MjfYRLvQjTp8w1FOCEYcRUqRKQvAZyYwOBbQ+2G5ohZMhgSZJ0HnAhUgZst5oamrOYXnLjrOOsVsZLs4S7FJLIMx2f8syEoEHjtygZhxIGBFxXtcTHIhnnDA5wMh6DEs4Ja39SnAEKHOv1Ja5CL8Fw3Ue1Y8VYlQukdrNH1UhgK2Qnhga2/Bp3XacbpZyH1p5HUmSTCBBwnNWNiYUCTT8hpns4hRN0D9U8ZPR46ESfCk8doLRiqKe92UyOPm4L0pR198YL3dEl4IOvILpPNdFLZOmt8+hjyxffeOF1eqpi9+YOwi/lYmHMlXOSD9wm0h6xFu+FgDSfZJ80=----ATTACHMENT:----MzQxODU3NjU5OTc0MDU4NyA3ODIwMzk0ODE1Mjg0MjQ3IDM4NDkwMjAyNjQ0OTE4MjU=