注册函数
@param $func_name
@param $func
@return unknown_type
559836
function reg_func($func_name,$func)
	{
	    if(!function_exists($func)) error(903);
	    $this->func_list[$func_name] = $func;
	}
1344937
public function setFunc($func)
    {
        if ($func === null) {
            $this->func = $func;
            return $this;
        }

        if (!is_string($func)) {
            throw new InvalidArgumentException(
                'Function name should be a string.'
            );
        }

        $func = strtoupper($func);
        if (!in_array($func, $this->validFunc())) {
            throw new InvalidArgumentException(sprintf(
                'Function "%s" not allowed in this context.',
                $func
            ));
        }

        $this->func = $func;
        return $this;
    }
1326975
String getFunctionName(int funcID) {
      if (funcID < NUM_BUILT_IN_FUNCS) return m_functions[funcID].getName();
      else return m_functions_customer[funcID - NUM_BUILT_IN_FUNCS].getName();
  }
341089
public function find(callable $func)
    {
        $found = null;

        foreach ($this->elements as $key => $value) {
            if($func($value, $key)) {
                $found = $value;
                break;
            }
        }

        return $found;
    }
271549
protected function image($type, $thumb, $name, $func = null)
    {
        $func = strtolower(__FUNCTION__.$type);
        $rootPath = $this->rootDir.DS.str_replace(['/', '\\'], DS, $this->thumbPath).$name;
        /** @var $func TYPE_NAME */
        //if (is_callable($func)) {
        if (!$func($thumb, $rootPath)) {
            throw new \Exception('Unknown Exception while generating thumb image');
        }

        chmod($rootPath, 0777);
    }
115864
public function map(callable $func)
    {
        $containers = array_slice(func_get_args(), 1); // remove `$func`

        if (empty($containers)) {
            return new static((new HaystackMap($this))->map($func));
        }

        return new static((new HaystackMap($this))->map($func, $containers));
    }
112883
public function addFunc(FunctionEntity $func)
    {
        $this->fullClassName = $func->getClass();

        // Skip the method if it's an @internal one.
        $methodFullDoc = (new ReflectionMethod($this->fullClassName, $func->getName()))->getDocComment();
        foreach (explode(PHP_EOL, $methodFullDoc) as $line) {
            if (strpos($line, ' @internal ') !== false) {
                return '';
            }
        }

        $str = PHP_EOL . '<h3>' . $func->getName() . '</h3>' . "\n\n<hr>\n\n";

        $str .= $this->parser->text($func->getDescription());

        if (!$func->getExample()) {
            throw new RuntimeException("Method {$func->getClass()}::{$func->getName()} is missing an example.");
        }

        $rawExample = $func->getExample();
        $example = $this->parser->text($rawExample);
        $str .= PHP_EOL . $example;

        if ($func->hasParams()) {
            $str .= PHP_EOL . '<h4>Parameters</h4>' . PHP_EOL . '<ul>';
            $params = [];
            foreach ($func->getParams() as $param) {
                $paramStr = sprintf('<li><code>%s</code> <strong>%s</strong>', $param->getType(), $param->getName());

                $description = $param->getDescription();

                if (!empty($description)) {
                    $paramStr .= ' - ' . $this->parser->line($param->getDescription());
                }

                $params[] = $paramStr . '</li>';
            }
            $str .= PHP_EOL . implode(PHP_EOL, $params);
            $str .= '</ul>';
        }


        $this->output .= PHP_EOL . $str . PHP_EOL  . '  ';
        $this->index[] = $func->getName();
        return $str;
    }
528339
function(func) {
        var found = false;
        var funcString = func.toString();
        var args = funcString.match(/^\s*function\s+(?:\w*\s*)?\((.*?)\)/);
        args = args ? (args[1] ? args[1].trim().split(/\s*,\s*/) : []) : null;

        if (args.length > 0) {
//            var cb;
//            for (var a = 0; a < args.length; ++a) {
//                console.log('......checking ', args[a]);
//                cb = funcString.match(/(callback|cb)\s*\(/g);
//                if (cb) {
//                    //console.log('.......??? ', cb);
//                    return args[a]
//                }
//            }
            return args
        }

        return found
    }
674015
public function getReflector($funcName)
    {
        /*
         * Check if the optimizer is already cached
         */
        if (!isset(self::$functionReflection[$funcName])) {
            try {
                $reflectionFunction = new \ReflectionFunction($funcName);
            } catch (\ReflectionException $e) {
                $reflectionFunction = null;
            }
            self::$functionReflection[$funcName] = $reflectionFunction;
            $this->reflection = $reflectionFunction;

            return $reflectionFunction;
        }
        $reflectionFunction = self::$functionReflection[$funcName];
        $this->reflection = $reflectionFunction;

        return $reflectionFunction;
    }
950354
public static function sorter($name, $func = null, $type = null)
    {
        if (!isset($func)) {
            $func = function ($a, $b) {
                if ($a == $b) {
                    return 0;
                }
                return $a < $b ? -1 : 1;
            };
        }
        
        if ($type == self::GETTER) {
            $method = 'get' . $name;
            return function ($a, $b) use ($method, $func) {
                return call_user_func($func, $a->$method(), $b->$method());
            };
        } elseif ($type == self::OBJ) {
            return function ($a, $b) use ($name, $func) {
                return call_user_func($func, $a->$name, $b->$name);
            };
        } else {
            return function ($a, $b) use ($name, $func) {
                return call_user_func($func, $a[$name], $b[$name]);
            };
        }
    }
829336
function (func) {
        if (_cs.annotation(func, "clone") === null)
            while (_cs.annotation(func.caller, "clone") === true)
                func = func.caller;
        return func;
    }
1142452
def __get_function_or_ex_function(self, func_name):
        
        # try function name as given
        try:
            return getattr(self.driver, func_name)
        except AttributeError:
            pass
        # try prefixing name with `ex_`
        try:
            return getattr(self.driver, 'ex_' + func_name)
        except AttributeError:
            pass
        # no such function
        raise AttributeError(
            "No function named `{0}` or `{1}` in class `{2}`"
            .format(func_name, 'ex_'+func_name, self.__class__.__name__))
620071
function function_dump($funcname) 
    {
        try {
            if(is_array($funcname)) {
                $func = new ReflectionMethod($funcname[0], $funcname[1]);
                $funcname = $funcname[1];
            } else {
                $func = new ReflectionFunction($funcname);
            }
        } catch (ReflectionException $e) {
            return $e->getMessage();
        }
        $start = $func->getStartLine() - 1;
        $end =  $func->getEndLine() - 1;
        $filename = $func->getFileName();
        return "function $funcname defined by $filename($start - $end)\n";
    }
907482
public static function getDescriptions($function_name)
    {
        if (is_string($function_name))
            $reflection = new ReflectionFunction($function_name);
        elseif (is_array($function_name))
            $reflection = new ReflectionMethod($function_name[0], $function_name[1]);
        else
            throw new LogicException();

        $comment = $reflection->getDocComment();

        $lines = explode("\n", $comment);
        $obj = new self($lines);

        return array(trim($obj->short_desc), trim($obj->long_desc));
    }
335596
public function filter($func)
    {
        $index = 0;
        $nodes = [];
        foreach ($this->_nodes as $node) {
            $selector = new Selector($this->_document, $node);
            if ($func($selector, $index++) !== false) {
                $nodes[] = $node;
            }
        }

        return new SelectorList($this, $nodes);
    }
906324
public function registerFunction($name, $func, $prototype = null)
    {
        $this->userFunctions[$this->normalizeName($name)] = [$func, $prototype];
    }
1361867
def register_func(self, func_name, func_kwargs):
        
        self.scan_funcs.append(func_name)
        self.scan_kwargs.append(func_kwargs)