src/com_jjcbs/fun/AnnotationFun.php
public static function createClosure(string $methodStr , string $methodName , string $data = '') : string {
        if ( empty($data)){
            // no function body
            return '$fun = ' . preg_replace('/public|static|protected|private|public static|protected static|private static/'
                    , '' , str_replace($methodName , '' , $methodStr )
                . "\n\n//exec\n"
                . '$fun' . self::getMethodParamStr($methodStr));
        }else{
            return '$fun = ' . preg_replace('/public|static|protected|private|public static|protected static|private static/'
                    , '' , str_replace($methodName , '' , $methodStr )
                . "\n\n//exec\n"
                . sprintf($data , '$fun' . self::getMethodParamStr($methodStr) ));
        }
    }
public static function createClosure(string $methodStr , string $methodName , string $data = '') : string {
        if ( empty($data)){
            // no function body
            return '$fun = ' . preg_replace('/public|static|protected|private|public static|protected static|private static/'
                    , '' , str_replace($methodName , '' , $methodStr )
                . "\n\n//exec\n"
                . '$fun' . self::getMethodParamStr($methodStr));
        }else{
            return '$fun = ' . preg_replace('/public|static|protected|private|public static|protected static|private static/'
                    , '' , str_replace($methodName , '' , $methodStr )
                . "\n\n//exec\n"
                . sprintf($data , '$fun' . self::getMethodParamStr($methodStr) ));
        }
    }
public static function createClosure ( string $ methodStr , string $ methodName , string $ data = '' ) : string { if ( empty ( $ data ) ) { // no function body return '$fun = ' . preg_replace ( '/public|static|protected|private|public static|protected static|private static/' , '' , str_replace ( $ methodName , '' , $ methodStr ) . "\n\n//exec\n" . '$fun' . self :: getMethodParamStr ( $ methodStr ) ) ; } else { return '$fun = ' . preg_replace ( '/public|static|protected|private|public static|protected static|private static/' , '' , str_replace ( $ methodName , '' , $ methodStr ) . "\n\n//exec\n" . sprintf ( $ data , '$fun' . self :: getMethodParamStr ( $ methodStr ) ) ) ; } }
create a closure by old method str
@param string $methodStr
@param string $methodName
@param string $data
@return string
create a closure by old method str