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 declare(strict_types=1); /** * This file is part of CodeIgniter 4 framework. * ..
Decoded Output download
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <[email protected]>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Test;
use LogicException;
trait ConfigFromArrayTrait
{
/**
* Creates a Config instance from an array.
*
* @template T of \CodeIgniter\Config\BaseConfig
*
* @param class-string<T> $classname Config classname
* @param array<string, mixed> $config
*
* @return T
*/
private function createConfigFromArray(string $classname, array $config)
{
$configObj = new $classname();
foreach ($config as $key => $value) {
if (property_exists($configObj, $key)) {
$configObj->{$key} = $value;
continue;
}
throw new LogicException(
'No such property: ' . $classname . '::$' . $key
);
}
return $configObj;
}
}
?>
Did this file decode correctly?
Original Code
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <[email protected]>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Test;
use LogicException;
trait ConfigFromArrayTrait
{
/**
* Creates a Config instance from an array.
*
* @template T of \CodeIgniter\Config\BaseConfig
*
* @param class-string<T> $classname Config classname
* @param array<string, mixed> $config
*
* @return T
*/
private function createConfigFromArray(string $classname, array $config)
{
$configObj = new $classname();
foreach ($config as $key => $value) {
if (property_exists($configObj, $key)) {
$configObj->{$key} = $value;
continue;
}
throw new LogicException(
'No such property: ' . $classname . '::$' . $key
);
}
return $configObj;
}
}
Function Calls
None |
Stats
MD5 | 0165c20bf0c981379683e28ea650ade9 |
Eval Count | 0 |
Decode Time | 97 ms |