Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- Mock static method --FILE-- <?php declare(strict_types=1); class Foo { privat..
Decoded Output download
--TEST--
Mock static method
--FILE--
<?php declare(strict_types=1);
class Foo
{
private function bar(callable $arg){}
}
require_once __DIR__ . '/../../../bootstrap.php';
$class = new ReflectionClass('Foo');
$mockMethod = \PHPUnit\Framework\MockObject\Generator\MockMethod::fromReflection(
$class->getMethod('bar'),
false,
false
);
$code = $mockMethod->generateCode();
print $code;
--EXPECT--
private function bar(callable $arg)
{
$__phpunit_definedVariables = get_defined_vars();
$__phpunit_namedVariadicParameters = [];
foreach ($__phpunit_definedVariables as $__phpunit_definedVariableName => $__phpunit_definedVariableValue) {
if ((new ReflectionParameter([__CLASS__, __FUNCTION__], $__phpunit_definedVariableName))->isVariadic()) {
foreach ($__phpunit_definedVariableValue as $__phpunit_key => $__phpunit_namedValue) {
if (is_string($__phpunit_key)) {
$__phpunit_namedVariadicParameters[$__phpunit_key] = $__phpunit_namedValue;
}
}
}
}
$__phpunit_arguments = [$arg];
$__phpunit_count = func_num_args();
if ($__phpunit_count > 1) {
$__phpunit_arguments_tmp = func_get_args();
for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {
$__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i];
}
}
$__phpunit_arguments = array_merge($__phpunit_arguments, $__phpunit_namedVariadicParameters);
$__phpunit_result = $this->__phpunit_getInvocationHandler()->invoke(
new \PHPUnit\Framework\MockObject\Invocation(
'Foo', 'bar', $__phpunit_arguments, '', $this, false
)
);
return $__phpunit_result;
}
?>
Did this file decode correctly?
Original Code
--TEST--
Mock static method
--FILE--
<?php declare(strict_types=1);
class Foo
{
private function bar(callable $arg){}
}
require_once __DIR__ . '/../../../bootstrap.php';
$class = new ReflectionClass('Foo');
$mockMethod = \PHPUnit\Framework\MockObject\Generator\MockMethod::fromReflection(
$class->getMethod('bar'),
false,
false
);
$code = $mockMethod->generateCode();
print $code;
--EXPECT--
private function bar(callable $arg)
{
$__phpunit_definedVariables = get_defined_vars();
$__phpunit_namedVariadicParameters = [];
foreach ($__phpunit_definedVariables as $__phpunit_definedVariableName => $__phpunit_definedVariableValue) {
if ((new ReflectionParameter([__CLASS__, __FUNCTION__], $__phpunit_definedVariableName))->isVariadic()) {
foreach ($__phpunit_definedVariableValue as $__phpunit_key => $__phpunit_namedValue) {
if (is_string($__phpunit_key)) {
$__phpunit_namedVariadicParameters[$__phpunit_key] = $__phpunit_namedValue;
}
}
}
}
$__phpunit_arguments = [$arg];
$__phpunit_count = func_num_args();
if ($__phpunit_count > 1) {
$__phpunit_arguments_tmp = func_get_args();
for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {
$__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i];
}
}
$__phpunit_arguments = array_merge($__phpunit_arguments, $__phpunit_namedVariadicParameters);
$__phpunit_result = $this->__phpunit_getInvocationHandler()->invoke(
new \PHPUnit\Framework\MockObject\Invocation(
'Foo', 'bar', $__phpunit_arguments, '', $this, false
)
);
return $__phpunit_result;
}
Function Calls
None |
Stats
MD5 | 6d4f75ca5ac685bcf74a11839b3d7bee |
Eval Count | 0 |
Decode Time | 77 ms |