| @@ -24,7 +24,7 @@ | ||
| 24 | 24 | $this->certificates->push($this->lastCertificate()->fetchParentCertificate()); | 
| 25 | 25 | } | 
| 26 | 26 | |
| 27 | -        return $this->certificates->map(function (Certificate $certificate) { | |
| 27 | +        return $this->certificates->map(function(Certificate $certificate) { | |
| 28 | 28 | return $certificate->getContents(); | 
| 29 | 29 |          })->implode(''); | 
| 30 | 30 | } | 
| @@ -51,14 +51,14 @@ discard block | ||
| 51 | 51 | |
| 52 | 52 |          $certificateFile = $input->getArgument('certificate'); | 
| 53 | 53 | |
| 54 | -        if (! file_exists($certificateFile)) { | |
| 54 | +        if (!file_exists($certificateFile)) { | |
| 55 | 55 | throw CouldNotRunCommand::inputFileDoesNotExist($certificateFile); | 
| 56 | 56 | } | 
| 57 | 57 | |
| 58 | 58 |          $outputFile = $input->getArgument('outputFile') ?: 'certificate-including-trust-chain.crt'; | 
| 59 | 59 | |
| 60 | 60 |          if (file_exists($outputFile)) { | 
| 61 | -            if (! $this->confirmOverwrite($input, $output, $outputFile)) { | |
| 61 | +            if (!$this->confirmOverwrite($input, $output, $outputFile)) { | |
| 62 | 62 |                  $output->writeln('<info>Cancelling...</info>'); | 
| 63 | 63 | |
| 64 | 64 | return true; | 
| @@ -77,7 +77,7 @@ discard block | ||
| 77 | 77 | |
| 78 | 78 | protected function guardAgainstInvalidInput(string $certificateFile) | 
| 79 | 79 |      { | 
| 80 | -        if (! file_exists($certificateFile)) { | |
| 80 | +        if (!file_exists($certificateFile)) { | |
| 81 | 81 | throw CouldNotRunCommand::inputFileDoesNotExist($certificateFile); | 
| 82 | 82 | } | 
| 83 | 83 | } | 
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 |          $helper = $this->getHelper('question'); | 
| 90 | 90 |          $question = new ConfirmationQuestion('<comment>Outputfile '.$outputFile.' already exists. Do you want to overwrite it? (y/n) </comment>', false); | 
| 91 | 91 | |
| 92 | -        if (! $helper->ask($input, $output, $question)) { | |
| 92 | +        if (!$helper->ask($input, $output, $question)) { | |
| 93 | 93 | return false; | 
| 94 | 94 | } | 
| 95 | 95 | |
| @@ -41,7 +41,7 @@ | ||
| 41 | 41 | * @param InputInterface $input | 
| 42 | 42 | * @param OutputInterface $output | 
| 43 | 43 | * | 
| 44 | - * @return int|null|void | |
| 44 | + * @return boolean|null | |
| 45 | 45 | * | 
| 46 | 46 | * @throws Exception | 
| 47 | 47 | */ | 
| @@ -6,11 +6,11 @@ | ||
| 6 | 6 | use GuzzleHttp\Client; | 
| 7 | 7 | use Spatie\CertificateChain\Certificate; | 
| 8 | 8 | use Spatie\CertificateChain\CertificateChain; | 
| 9 | +use Spatie\CertificateChain\Exceptions\CouldNotRunCommand; | |
| 9 | 10 | use Symfony\Component\Console\Command\Command; | 
| 10 | 11 | use Symfony\Component\Console\Input\InputArgument; | 
| 11 | 12 | use Symfony\Component\Console\Input\InputInterface; | 
| 12 | 13 | use Symfony\Component\Console\Output\OutputInterface; | 
| 13 | -use Spatie\CertificateChain\Exceptions\CouldNotRunCommand; | |
| 14 | 14 | use Symfony\Component\Console\Question\ConfirmationQuestion; | 
| 15 | 15 | |
| 16 | 16 | class ResolveCommand extends Command | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | $certificate = $contents; | 
| 46 | 46 | |
| 47 | 47 | // If we are missing the pem certificate header, try to convert it to a pem format first | 
| 48 | -        if (! empty($contents) && strpos($contents, '-----BEGIN CERTIFICATE-----') === false) { | |
| 48 | +        if (!empty($contents) && strpos($contents, '-----BEGIN CERTIFICATE-----') === false) { | |
| 49 | 49 | // Extract from either a PKCS#7 format or DER formatted contents | 
| 50 | 50 | $certificate = self::convertPkcs72Pem($contents) ?? self::convertDer2Pem($contents); | 
| 51 | 51 | } | 
| @@ -86,7 +86,7 @@ discard block | ||
| 86 | 86 | // Only allow for parent certificates to be read from HTTP and HTTPS URLs to | 
| 87 | 87 | // prevent local file inclusion vulnerabilities | 
| 88 | 88 | $scheme = parse_url($url, PHP_URL_SCHEME); | 
| 89 | -        if (! in_array($scheme, ['http', 'https'])) { | |
| 89 | +        if (!in_array($scheme, ['http', 'https'])) { | |
| 90 | 90 | throw CouldNotLoadCertificate::invalidCertificateUrl($url); | 
| 91 | 91 | } | 
| 92 | 92 | |
| @@ -95,7 +95,7 @@ discard block | ||
| 95 | 95 | |
| 96 | 96 | public function hasParentInTrustChain(): bool | 
| 97 | 97 |      { | 
| 98 | - return ! $this->getParentCertificateUrl() == ''; | |
| 98 | + return !$this->getParentCertificateUrl() == ''; | |
| 99 | 99 | } | 
| 100 | 100 | |
| 101 | 101 | public function getContents(): string | 
| @@ -107,7 +107,7 @@ discard block | ||
| 107 | 107 | |
| 108 | 108 | protected function guardAgainstInvalidContents(string $content, string $original) | 
| 109 | 109 |      { | 
| 110 | -        if (! (new X509())->loadX509($content)) { | |
| 110 | +        if (!(new X509())->loadX509($content)) { | |
| 111 | 111 | throw CouldNotCreateCertificate::invalidContent($original); | 
| 112 | 112 | } | 
| 113 | 113 | } |