Command/SslCertificateCommand.php
public function execute(InputInterface $input, OutputInterface $output)
    {
        $server = trim($input->getOption('server'));
        $port = (int) $input->getOption('port');
        if (!$server) {
            throw new \Exception('You must enter a server name.');
        }

        $certs = LdapUtilities::getLdapSslCertificates($server, $port);
        $bundle = $certs['peer_certificate'].implode('', $certs['peer_certificate_chain']);
        if (empty($bundle)) {
            $output->writeln(sprintf('<error>Unable to retrieve SSL certificate from %s on port %s.</error>', $server, $port));

            return 1;
        }
        $output->writeln($bundle);

        return 0;
    }
public function execute(InputInterface $input, OutputInterface $output)
    {
        $server = trim($input->getOption('server'));
        $port = (int) $input->getOption('port');
        if (!$server) {
            throw new \Exception('You must enter a server name.');
        }

        $certs = LdapUtilities::getLdapSslCertificates($server, $port);
        $bundle = $certs['peer_certificate'].implode('', $certs['peer_certificate_chain']);
        if (empty($bundle)) {
            $output->writeln(sprintf('<error>Unable to retrieve SSL certificate from %s on port %s.</error>', $server, $port));

            return 1;
        }
        $output->writeln($bundle);

        return 0;
    }
{@inheritdoc}