create a closure by old method str
@param string $methodStr
@param string $methodName
@param string $data
@return string
329265
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) ));
        }
    }
566680
private function getTokens($methodName)
    {
        preg_match_all('([A-Z_-][^A-Z_-]*)', $methodName, $rawTokens);
        $result = array();
        $lastToken = null;
        $seenBy = false;
        foreach ($rawTokens[0] as $token) {
            $newToken = $this->getToken($token, $seenBy);

            if ($newToken instanceof ValueToken) {
                $lastToken = $lastToken !== null && $lastToken instanceof ValueToken ?
                    new ValueToken($lastToken->getSource() . $newToken->getSource()) :
                    $newToken;
            } else {
                if ($lastToken instanceof ValueToken) {
                    // Add the last token too
                    $result[] = $lastToken;
                    $lastToken = null;
                }
                $result[] = $newToken;
            }
        }

        if ($lastToken !== null) {
            $result[] = $lastToken;
        }


        return $result;
    }
1258893
function setIgnoredMethods(array $methodName)
    {
        foreach($methodName as $im)
            $this->ignoredMethods[] = (string) $im;

        return $this;
    }
1317229
function getMethod($methodName)
    {
        if (!$this->hasMethod($methodName))
            throw new \Exception(sprintf(
                'Method (%s) not found.'
                , $methodName
            ));

        if (isset($this->_t__methods[$methodName])) {
            ## from bind closure
            $methodCallable = $this->_t__methods[$methodName];
        } else {
            $bindTo = $this->getBindTo();
            $methodCallable = function() use($methodName, $bindTo) {
                return call_user_func_array([$bindTo, $methodName], func_get_args());
            };
        }

        ## bind it into latest bind object
        $methodCallable = \Closure::bind(
            $methodCallable
            , $this->getBindTo()
            , get_class($this->getBindTo())
        );

        return $methodCallable;
    }
1119866
public void replaceStr(Pointer str, int len, ScalarStyle style) {
        Data.Str s = (Data.Str)data;
        s.ptr = Pointer.create(new byte[len], 0);
        s.len = len;
        s.style = style;
        str.memcpy(s.ptr, len);
    }
894991
protected function bindElementClosure($methodName, Closure $closure)
    {
        $this->elementClosures[$methodName] = $closure->bindTo($this);

        return $this;
    }
794156
private function isMethodIncluded($methodName, $attr)
    {
        if (empty($attr[self::CONFIG_INCLUDE]) || !is_array($attr[self::CONFIG_INCLUDE])) {
            return true;
        }
        
        return in_array($methodName, $attr[self::CONFIG_INCLUDE]);
    }
1014028
protected function createAndReturnNewFirstEntity($data, $entityName)
    {
        if (is_array($data)) {
            $entity = $this->getFirstEntityByName($entityName);
            return $this->mapAttributesFromSecondEntityToFirstEntityAndReturnEntity($data, $entity);
        }

        return null;
    }
912358
public function invoke($methodName, array $arguments = [])
    {
        $this->trigger(self::EVENT_BEFORE_METHOD);
        $result = call_user_func_array([$this->o, $methodName], $arguments);
        $this->trigger(self::EVENT_AFTER_METHOD);
        return $result;
    }
364135
public function create($methodName, $params)
    {
        $newInstance = clone $this->injectorPrototype;

        if (!is_array($params)) {
            $params = array($params);
        }

        return $newInstance->setMethodName($methodName)->setParams($params);
    }
1200242
public static function callMethod($objectOrClass, string $methodName, ...$args)
    {
        $objectOrClass = self::getObject($objectOrClass);
        $closure =
            /**
             * @param string $methodName
             * @param array $args
             * @return mixed
             */
            function (string $methodName, ...$args) {
                if (\method_exists($this, $methodName)) {
                    return $this->$methodName(...$args);
                }
                throw new \RuntimeException(
                    Picklock::errorMessage($this, $methodName, true)
                );
            };
        return
            $closure->call($objectOrClass, $methodName, ...$args);
    }
1328430
public static function unserializeAdvice(array $adviceData): Closure
    {
        $aspectName = $adviceData['class'];
        $methodName = $adviceData['method'];

        if (!isset(static::$localAdvicesCache["$aspectName->$methodName"])) {
            $aspect    = AspectKernel::getInstance()->getContainer()->getAspect($aspectName);
            $refMethod = new ReflectionMethod($aspectName, $methodName);
            $advice    = $refMethod->getClosure($aspect);

            static::$localAdvicesCache["$aspectName->$methodName"] = $advice;
        }

        return static::$localAdvicesCache["$aspectName->$methodName"];
    }
83570
function methodCall( $elems, methodName, args ) {
    var returnValue;
    var pluginMethodStr = '$().' + namespace + '("' + methodName + '")';

    $elems.each( function( i, elem ) {
      // get instance
      var instance = $.data( elem, namespace );
      if ( !instance ) {
        logError( namespace + ' not initialized. Cannot call methods, i.e. ' +
          pluginMethodStr );
        return;
      }

      var method = instance[ methodName ];
      if ( !method || methodName.charAt(0) == '_' ) {
        logError( pluginMethodStr + ' is not a valid method' );
        return;
      }

      // apply method, get return value
      var value = method.apply( instance, args );
      // set return value if value is returned, use only first value
      returnValue = returnValue === undefined ? value : returnValue;
    });

    return returnValue !== undefined ? returnValue : $elems;
  }
662808
function (methodName) {
            var oldy = this[methodName], self = this
            // overwrite the orig method
            this[methodName] = function() {
                var args              = [].slice.call(arguments)
                ,   beforeObj         = args[0] 
                ,   oldCallback       = args[args.length - 1]
                ,   overwroteCallback = false
                
                // call before with obj
                this.fire('before', methodName, beforeObj)

                if (typeof oldCallback === 'function') {
                    // overwrite final callback with after method injection 
                    args[args.length - 1] = function(record) {
                        oldCallback.call(self, record)
                        self.fire('after', methodName, record)
                    }
                    overwroteCallback = true
                }

                // finally call the orig method
                oldy.apply(self, args)

                // if there was no callback to override for after we invoke here
                if (!overwroteCallback) 
                    self.fire('after', methodName, beforeObj)
            }
        }
897330
protected static function parseMethodExec($data = null){
        self::$input =  AnnotationFun::replaceMethodStr(self::$body , AnnotationFun::createClosure(self::$body , self::$argv['methodName'], $data) , self::$input);
    }
1146755
public static Matcher<MethodTree> methodIsNamed(final String methodName) {
    return new Matcher<MethodTree>() {
      @Override
      public boolean matches(MethodTree methodTree, VisitorState state) {
        return methodTree.getName().contentEquals(methodName);
      }
    };
  }
1087492
protected function call($eventName, $method, $data = null)
    {
        if (method_exists($this, $method)) {
            $result = call_user_func_array([$this, $method], $data);
            return $result;
        }

        return null;
    }