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 /** * Created by IntelliJ IDEA. * User: winglechen * Date: 16/4/3 * Time: 12:53 ..

Decoded Output download

<?php
/**
 * Created by IntelliJ IDEA.
 * User: winglechen
 * Date: 16/4/3
 * Time: 12:53
 */

namespace Zan\Framework\Test\Utilities\Types;

use Zan\Framework\Utilities\Types\Func;

class FuncTest extends \TestCase
{
    public function testCallWork()
    {
        $func = function($arg){
            return $arg;
        };

        $expect = 'demo func';
        $output = Func::call($func, $expect);

        $this->assertEquals($expect, $output, 'Func::call fail');
    }

    public function testToClosureWork()
    {
        $func = function($arg){
            return $arg;
        };

        $validator = function(){
            if(func_num_args() === 2) {
                return true;
            }

            return false;
        };

        $arg = 'func closure';
        $closure = Func::toClosure($func, $arg, $validator);

        $output = $closure();
        $this->assertNull($output, 'Func::toClosure work fail');

        $output = $closure(1,2);
        $this->assertNotNull($output, 'Func::toClosure work fail');
        $this->assertEquals($arg, $output, 'Func::toClosure work fail');
    }
} ?>

Did this file decode correctly?

Original Code

<?php
/**
 * Created by IntelliJ IDEA.
 * User: winglechen
 * Date: 16/4/3
 * Time: 12:53
 */

namespace Zan\Framework\Test\Utilities\Types;

use Zan\Framework\Utilities\Types\Func;

class FuncTest extends \TestCase
{
    public function testCallWork()
    {
        $func = function($arg){
            return $arg;
        };

        $expect = 'demo func';
        $output = Func::call($func, $expect);

        $this->assertEquals($expect, $output, 'Func::call fail');
    }

    public function testToClosureWork()
    {
        $func = function($arg){
            return $arg;
        };

        $validator = function(){
            if(func_num_args() === 2) {
                return true;
            }

            return false;
        };

        $arg = 'func closure';
        $closure = Func::toClosure($func, $arg, $validator);

        $output = $closure();
        $this->assertNull($output, 'Func::toClosure work fail');

        $output = $closure(1,2);
        $this->assertNotNull($output, 'Func::toClosure work fail');
        $this->assertEquals($arg, $output, 'Func::toClosure work fail');
    }
}

Function Calls

None

Variables

None

Stats

MD5 593ee8c3b8f01cea4e4f7537ac4f1974
Eval Count 0
Decode Time 121 ms