AcmePhp\Cli\Command\StatusCommand::execute PHP Метод

execute() защищенный Метод

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $repository = $this->getRepository();
        /** @var FilesystemInterface $master */
        $master = $this->getContainer()->get('repository.master_storage');
        /** @var CertificateParser $certificateParser */
        $certificateParser = $this->getContainer()->get('ssl.certificate_parser');
        $table = new Table($output);
        $table->setHeaders(['Domain', 'Issuer', 'Valid from', 'Valid to', 'Needs renewal?']);
        $directories = $master->listContents('certs');
        foreach ($directories as $directory) {
            if ($directory['type'] !== 'dir') {
                continue;
            }
            $parsedCertificate = $certificateParser->parse($repository->loadDomainCertificate($directory['basename']));
            $domainString = $parsedCertificate->getSubject();
            $alternativeNames = array_diff($parsedCertificate->getSubjectAlternativeNames(), [$parsedCertificate->getSubject()]);
            if (count($alternativeNames)) {
                sort($alternativeNames);
                $last = array_pop($alternativeNames);
                foreach ($alternativeNames as $alternativeName) {
                    $domainString .= "\n ├── " . $alternativeName;
                }
                $domainString .= "\n └── " . $last;
            }
            $table->addRow([$domainString, $parsedCertificate->getIssuer(), $parsedCertificate->getValidFrom()->format('Y-m-d H:i:s'), $parsedCertificate->getValidTo()->format('Y-m-d H:i:s'), $parsedCertificate->getValidTo()->format('U') - time() < 604800 ? '<comment>Yes</comment>' : 'No']);
        }
        $table->render();
    }