Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /* * This file is part of the Acme PHP project. * * (c) Titouan Galopin <galopin..
Decoded Output download
<?php
/*
* This file is part of the Acme PHP project.
*
* (c) Titouan Galopin <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AcmePhp\Ssl\Generator;
use AcmePhp\Ssl\PrivateKey;
/**
* Generate random RSA private key using OpenSSL.
*
* @author Jrmy Deruss <[email protected]>
*/
class ChainPrivateKeyGenerator implements PrivateKeyGeneratorInterface
{
/** @var PrivateKeyGeneratorInterface[] */
private $generators;
/**
* @param PrivateKeyGeneratorInterface[] $generators
*/
public function __construct(iterable $generators)
{
$this->generators = $generators;
}
public function generatePrivateKey(KeyOption $keyOption): PrivateKey
{
foreach ($this->generators as $generator) {
if ($generator->supportsKeyOption($keyOption)) {
return $generator->generatePrivateKey($keyOption);
}
}
throw new \LogicException(sprintf('Unable to find a generator for a key option of type %s', \get_class($keyOption)));
}
public function supportsKeyOption(KeyOption $keyOption): bool
{
foreach ($this->generators as $generator) {
if ($generator->supportsKeyOption($keyOption)) {
return true;
}
}
return false;
}
}
?>
Did this file decode correctly?
Original Code
<?php
/*
* This file is part of the Acme PHP project.
*
* (c) Titouan Galopin <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AcmePhp\Ssl\Generator;
use AcmePhp\Ssl\PrivateKey;
/**
* Generate random RSA private key using OpenSSL.
*
* @author Jrmy Deruss <[email protected]>
*/
class ChainPrivateKeyGenerator implements PrivateKeyGeneratorInterface
{
/** @var PrivateKeyGeneratorInterface[] */
private $generators;
/**
* @param PrivateKeyGeneratorInterface[] $generators
*/
public function __construct(iterable $generators)
{
$this->generators = $generators;
}
public function generatePrivateKey(KeyOption $keyOption): PrivateKey
{
foreach ($this->generators as $generator) {
if ($generator->supportsKeyOption($keyOption)) {
return $generator->generatePrivateKey($keyOption);
}
}
throw new \LogicException(sprintf('Unable to find a generator for a key option of type %s', \get_class($keyOption)));
}
public function supportsKeyOption(KeyOption $keyOption): bool
{
foreach ($this->generators as $generator) {
if ($generator->supportsKeyOption($keyOption)) {
return true;
}
}
return false;
}
}
Function Calls
None |
Stats
MD5 | 6482514ab34b22fc723a09710a7c6a2c |
Eval Count | 0 |
Decode Time | 96 ms |