bobby/simple-codes-reflection

用于反射你自己代码内容(编写DEBUG)

dev-master 2020-02-18 14:32 UTC

This package is auto-updated.

Last update: 2024-10-19 01:08:44 UTC


README

class Unity
{
 	public static function success()
 	{
 		return 'ok';
 	}

 	public static function fail()
    {
        return 'error';
    }
}

echo \Bobby\SimpleReflectionCode\SimpleReflectionCode::handle(Unity::class);
echo \Bobby\SimpleReflectionCode\SimpleReflectionCode::handle(new Unity());
echo \Bobby\SimpleReflectionCode\SimpleReflectionCode::handle(new ReflectionMethod(Unity::class, "success"));
echo \Bobby\SimpleReflectionCode\SimpleReflectionCode::handle([Unity::class, "success"]);

echo \Bobby\SimpleReflectionCode\SimpleReflectionCode::handle([Unity::class, "fail"], 1, 2);

// output
/**
class Unity
{
        public static function success()
        {
                return 'ok';
        }

        public static function fail()
    {
        return 'error';
    }
}
class Unity
{
        public static function success()
        {
                return 'ok';
        }

        public static function fail()
    {
        return 'error';
    }
}
        public static function success()
        {
                return 'ok';
        }
        public static function success()
        {
                return 'ok';
        }

        public static function fail()
    {
**/