Generates the PHP wrapping code from a C/C++ function.
@param \Peg\Lib\Definitions\Element\FunctionElement $function_object
@return string PHP C/C++ code.
341777
function GenerateFunction(
        \Peg\Lib\Definitions\Element\FunctionElement $function_object
    )
    {
        // Variables used by some template files.
        $authors = \Peg\Lib\Settings::GetAuthors();
        $contributors = \Peg\Lib\Settings::GetContributors();
        $extension = \Peg\Lib\Settings::GetExtensionName();
        $version = \Peg\Lib\Settings::GetVersion();

        $namespace_name = $function_object->namespace->name;

        if($namespace_name == "\\")
            $namespace_name = "";

        $namespace_name_cpp = str_replace(
            "\\",
            "::",
            $namespace_name
        );

        $namespace_name_var = str_replace(
            "\\",
            "_",
            $namespace_name
        );

        $function_name = $function_object->name;
        $function_arginfo = $this->GenerateArgInfo($function_object);
        $overloads_count = count($function_object->overloads);

        $function_content = "";

        $parameters_code = "";
        $parse_code = "";
        $return_code = "";

        $proto_header = $this->GetProtoHeader($function_object);
        $proto_footer = $this->GetProtoFooter();

        // Get header of function
        ob_start();
            include($this->GetTemplatePath(
                $function_name,
                "function",
                "head",
                "functions",
                "",
                $namespace_name
            ));
            $function_content .= ob_get_contents();
        ob_end_clean();

         // Parameters declaration
        foreach($function_object->overloads as $overload=>$overload_object)
        {
            // Overload parameters declaration header
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "parameters_header",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $parameters_code .= ob_get_contents();
            ob_end_clean();

            foreach($overload_object->parameters as $parameter_name=>$parameter_object)
            {
                // Overload parameter declarations
                ob_start();
                    include($this->GetParameterTemplate($parameter_object, $namespace_name, "declare"));
                    $parameters_code .= ob_get_contents();
                ob_end_clean();
            }

            // Overload parameters declaration footer
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "parameters_footer",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $parameters_code .= ob_get_contents();
            ob_end_clean();
        }

        // Parse parameters code
        foreach($function_object->overloads as $overload=>$overload_object)
        {
            $parameters_count = $overload_object->GetParametersCount();
            $required_parameters = $overload_object->GetRequiredParametersCount();

            // Overload parse header
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "parse_header",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $parse_code .= ob_get_contents();
            ob_end_clean();

            $parse_string = "";
            $parameters_optional = false;
            $parse_parameters = "";

            $parse_references = "";
            $parse_string_ref = "";
            $parse_reference = "";
            $references_found = false;

            $object_validate_code = "";

            $parameter_index = 0;
            foreach($overload_object->parameters as $parameter_name=>$parameter_object)
            {
                if($parameter_object->default_value && !$parameters_optional)
                {
                    $parse_string .= "|";
                    $parse_string_ref = "|";
                    $parameters_optional = true;
                }

                ob_start();
                    include($this->GetParameterTemplate($parameter_object, $namespace_name, "parse_string"));
                    $parse_string .= ob_get_contents();
                ob_end_clean();

                ob_start();
                    include($this->GetParameterTemplate($parameter_object, $namespace_name, "parse"));
                    $parse_parameters .= ob_get_contents();
                ob_end_clean();

                if(!$parameter_object->is_const && $parameter_object->is_reference)
                    $references_found = true;

                ob_start();
                    include($this->GetParameterTemplate($parameter_object, $namespace_name, "parse_string_ref"));
                    $parse_string_ref .= ob_get_contents();
                ob_end_clean();

                ob_start();
                    include($this->GetParameterTemplate($parameter_object, $namespace_name, "parse_reference"));
                    $parse_reference .= ob_get_contents();
                ob_end_clean();

                if(
                    $this->symbols->GetStandardType($parameter_object)
                    ==
                    \Peg\Lib\Definitions\StandardType::OBJECT
                )
                {
                    ob_start();
                        include($this->GetParameterTemplate($parameter_object, $namespace_name, "object_validate"));
                        $object_validate_code .= $this->Indent(ob_get_contents(), 4);
                    ob_end_clean();
                }

                $parameter_index++;
            }

            // No parameters to parse
            if($required_parameters == 0 && $parameters_count < 1)
            {
                // Overload no parse body
                ob_start();
                    include($this->GetTemplatePath(
                        $function_name,
                        "overloads",
                        "parse_no_body",
                        "helpers",
                        "overload",
                        $namespace_name
                    ));
                    $parse_code .= $this->Indent(ob_get_contents(), 4);
                ob_end_clean();
            }
            // There is parameters to parse
            else
            {
                if($references_found)
                {
                    // Overload parse references
                    ob_start();
                        include($this->GetTemplatePath(
                            $function_name,
                            "overloads",
                            "parse_references",
                            "helpers",
                            "overload"
                        ));
                        $parse_references .= $this->Indent(ob_get_contents(), 4);
                    ob_end_clean();
                }

                // Overload parse body
                ob_start();
                    include($this->GetTemplatePath(
                        $function_name,
                        "overloads",
                        "parse_body",
                        "helpers",
                        "overload",
                        $namespace_name
                    ));
                    $parse_code .= $this->Indent(ob_get_contents(), 4);
                ob_end_clean();
            }

            // Overload parse footer
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "parse_footer",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $parse_code .= ob_get_contents();
            ob_end_clean();
        }

        // Return code
        foreach($function_object->overloads as $overload=>$overload_object)
        {
            $parameters_count = $overload_object->GetParametersCount();
            $required_parameters = $overload_object->GetRequiredParametersCount();

            $call_declare_code = "";

            // Optional declarations before proceeding to call an overload
            $parameter_index = 0;
            foreach($overload_object->parameters as $parameter_name=>$parameter_object)
            {
                ob_start();
                    include($this->GetParameterTemplate($parameter_object, "", "call_declare"));
                    $call_declare_code .= $this->Indent(ob_get_contents(), 4);
                ob_end_clean();

                $parameter_index++;
            }

            // Generate the overload return heading
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "return_header",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $return_code .= ob_get_contents();
            ob_end_clean();

            // Variables used by after call object template.
            $class_name = "";
            $is_constructor = false;

            for(
                $required_parameters;
                $required_parameters<=$parameters_count;
                $required_parameters++
            )
            {
                // Overload return body header
                ob_start();
                    include($this->GetTemplatePath(
                        $function_name,
                        "overloads",
                        "return_body_header",
                        "helpers",
                        "overload",
                        $namespace_name
                    ));
                    $return_code .= $this->Indent(ob_get_contents(), 8);
                ob_end_clean();

                $parameter_index = 0;
                $parameters_string = "";
                $after_call = "";

                foreach($overload_object->parameters as $parameter_name=>$parameter_object)
                {
                    if($parameter_index<$required_parameters)
                    {
                        ob_start();
                            include($this->GetParameterTemplate($parameter_object, "", "before_call"));
                            $before_call = $this->Indent(ob_get_contents(), 12);
                        ob_end_clean();

                        if(trim($before_call))
                            $return_code .= $before_call;

                        ob_start();
                            include($this->GetParameterTemplate($parameter_object, "", "call"));
                            $parameters_string .= ob_get_contents();
                        ob_end_clean();

                        ob_start();
                            include($this->GetParameterTemplate($parameter_object, "", "after_call"));
                            $after_call .= ob_get_contents();
                        ob_end_clean();
                    }
                    else
                    {
                        break;
                    }

                    $parameter_index++;
                }

                ob_start();
                    include($this->GetReturnTemplate($overload_object->return_type, "", "function"));
                    $return_code .= $this->Indent(ob_get_contents(), 12);
                ob_end_clean();

                $return_code .= $after_call;

                // Overload return body footer
                ob_start();
                    include($this->GetTemplatePath(
                        $function_name,
                        "overloads",
                        "return_body_footer",
                        "helpers",
                        "overload",
                        $namespace_name
                    ));
                    $return_code .= $this->Indent(ob_get_contents(), 8);
                ob_end_clean();
            }

            // Generate the overload return footer
            ob_start();
                include($this->GetTemplatePath(
                    $function_name,
                    "overloads",
                    "return_footer",
                    "helpers",
                    "overload",
                    $namespace_name
                ));
                $return_code .= ob_get_contents();
            ob_end_clean();
        }

        // Get body of function
        ob_start();
            include($this->GetTemplatePath(
                $function_name,
                "function",
                "body",
                "functions",
                "",
                $namespace_name
            ));
            $function_content .= $this->Indent(ob_get_contents(), 4);
        ob_end_clean();

        // Get footer of function
        ob_start();
            include($this->GetTemplatePath(
                $function_name,
                "function",
                "footer",
                "functions",
                "",
                $namespace_name
            ));
            $function_content .= ob_get_contents();
        ob_end_clean();

        return $function_content;
    }
499842
static function processElementTransformationChild( $useComments, $php, $tpl, &$node,
                                                $elementTree, $elementList, &$resourceData )
    {
        $count = is_countable( $elementList ) ? count( $elementList ) : 0;
        $lastElement = null;
        $newElementList = array();
        for ( $i = 0; $i < $count; ++$i )
        {
            $element =& $elementList[$i];
            $elementType = $element[0];
            if ( $elementType == eZTemplate::TYPE_OPERATOR )
            {
                $operatorName = $element[1][0];
                $operatorParameters = array_slice( $element[1], 1 );
                if ( !isset( $tpl->Operators[$operatorName] ) )
                    return false;

                if ( is_array( $tpl->Operators[$operatorName] ) )
                {
                    $tpl->loadAndRegisterOperators( $tpl->Operators[$operatorName] );
                }
                $operatorObject =& $tpl->Operators[$operatorName];
                if ( is_object( $operatorObject ) )
                {
                    $hasTransformationSupport = false;
                    $transformParameters = false;
                    $inputAsParameter = false;
                    $knownType = 'static';
                    if ( method_exists( $operatorObject, 'operatorTemplateHints' ) )
                    {
                        $hints = $operatorObject->operatorTemplateHints();
                        if ( isset( $hints[$operatorName] ) and
                             isset( $hints[$operatorName]['element-transformation'] ) and
                             $hints[$operatorName]['element-transformation'] )
                        {
                            $hasTransformationSupport = true;
                        }

                        if ( $hasTransformationSupport  and
                             isset( $hints[$operatorName]['element-transformation-func'] ) )
                        {
                            $transformationMethod = $hints[$operatorName]['element-transformation-func'];
                        }
                        else
                        {
                            $transformationMethod = 'templateElementTransformation';
                        }

                        if ( isset( $hints[$operatorName] ) and
                             isset( $hints[$operatorName]['transform-parameters'] ) )
                        {
                            $transformParameters = $hints[$operatorName]['transform-parameters'];
                        }

                        if ( isset( $hints[$operatorName] ) and
                             isset( $hints[$operatorName]['input-as-parameter'] ) )
                        {
                            $inputAsParameter = $hints[$operatorName]['input-as-parameter'];
                        }

                        if ( isset( $hints[$operatorName]['output'] ) and !$hints[$operatorName]['output'] )
                        {
                            $knownType = 'null';
                        }
                        else if ( isset( $hints[$operatorName]['output-type'] ) )
                        {
                            $knownType = $hints[$operatorName]['output-type'];
                        }
                    }
                    if ( $hasTransformationSupport and
                         method_exists( $operatorObject, $transformationMethod ) )
                    {
                        $resetNewElementList = false;
                        if ( $transformParameters )
                        {
                            $newParameters = array();
                            if ( $inputAsParameter )
                            {
                                $newParameterElements = eZTemplateCompiler::processElementTransformationChild( $useComments, $php, $tpl, $node,
                                                                                                               $elementTree, $newElementList, $resourceData );
                                if ( count( $newParameterElements ) > 0 or
                                     $inputAsParameter === 'always' )
                                {
                                    $newParameters[] = $newParameterElements;
                                    $resetNewElementList = true;
                                }
                            }

                            foreach ( $operatorParameters as $operatorParameter )
                            {
                                $newParameterElements = eZTemplateCompiler::processElementTransformationChild( $useComments, $php, $tpl, $node,
                                                                                                               $elementTree, $operatorParameter, $resourceData );
                                if ( !$newParameterElements )
                                    $newParameters[] = $operatorParameter;
                                else
                                    $newParameters[] = $newParameterElements;
                            }
                            $operatorParameters = $newParameters;
                        }

                        $newElements = $operatorObject->$transformationMethod( $operatorName, $node, $tpl, $resourceData,
                                                                               $element, $lastElement, $elementList, $elementTree,
                                                                               $operatorParameters );
                        if ( is_array( $newElements ) )
                        {
                            if ( $resetNewElementList )
                            {
                                $newElementList = $newElements;
                            }
                            else
                            {
                                $newElementList = array_merge( $newElementList, $newElements );
                            }
                        }
                        else
                        {
                            $newElementList[] = $element;
                        }
                    }
                    else
                    {
                        $newElementList[] = $element;
                    }
                }
                else if ( $resourceData['test-compile'] )
                {
                    $tpl->warning( '', "Operator '$operatorName' is not registered." );
                }
            }
            else
            {
                $newElementList[] = $element;
            }
            $lastElement = $element;
        }
        return $newElementList;
    }
1018883
function functionWriter(&$doclet) {

        parent::MDWriter($doclet);

        $this->_id = "definition";

        $rootDoc = & $this->_doclet->rootDoc();

        $packages = & $rootDoc->packages();
        ksort($packages);

        foreach ($packages as $packageName => $package) {
            $this->_depth = $package->depth() + 1;

            ob_start();

            echo "- - -\n\n";

            echo "#Functions#\n\n";

            echo "- - -\n\n";

            $functions = & $package->functions();

            if ($functions) {
                ksort($functions);
                echo "<table id=\"summary_function\" class=\"title\">", "\n";
                echo "<tr><th colspan=\"2\" class=\"title\">Function Summary</th></tr>", "\n";
                foreach ($functions as $function) {
                    $textTag = & $function->tags("@text");
                    echo "<tr>\n";
                    echo "<td>", $this->_methodSignature($function), "</td>\n";
                    echo "<td class=\"description\">";
                    echo "<p class=\"name\"><a href=\"#", $this->_asURL($function),"\">", $function->name(), "</a>", $this->_flatSignature($function), "</p>";
                    if ($textTag) {
                        echo "<p class=\"description\">", strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>"), "</p>";
                    }
                    echo "</td>\n";
                    echo "</tr>\n";
                }
                echo "</table>\n\n";

                echo "<h2 id=\"detail_function\">Function Detail</h2>", "\n";
                foreach ($functions as $function) {
                    $textTag = & $function->tags("@text");
                    $this->_sourceLocation($function);
                    echo "<h3 id=\"", $function->name(), "()\">", $function->name(), "</h3>\n";
                    echo $this->_methodSignature($function);
                    echo " {$function->name()} {$this->_flatSignature($function)}\n\n";
                    echo "<div class=\"details\">\n";
                    if ($textTag) {
                        echo $this->_processInlineTags($textTag), "\n";
                    }
                    $this->_processTags($function->tags());
                    echo "</div>\n\n";
                    echo "- - -\n\n";
                }
            }

            $this->_output = ob_get_contents();
            ob_end_clean();

            $this->_write($this->_normalize($package->_name) . "_package-functions.md");
        }
    }
1123716
public function compileFunction()
    {
        $params = func_get_args();
        $name = array_shift($params);
        array_pop($params);
        if (function_exists($name)) {
            return $name . '(' . join(', ', $params) . ')';
        }
    }
1224648
private function SaveFunctionsToPHP()
    {
        $output_file = fopen(
            $this->definitions_path . "functions.php", 
            "w"
        );
        
        fwrite($output_file, "<?php\n\n");
        
        fwrite($output_file, "use Peg\Lib\Definitions\Element\FunctionElement;\n");
        fwrite($output_file, "use Peg\Lib\Definitions\Element\Overload;\n");
        fwrite($output_file, "use Peg\Lib\Definitions\Element\ReturnType;\n");
        fwrite($output_file, "use Peg\Lib\Definitions\Element\Parameter;\n");
        
        foreach($this->symbols->headers as $header)
        {
            if(!$header->HasFunctions())
                continue;
            
            foreach($header->namespaces as $namespace)
            {
                if(!$namespace->HasFunctions())
                    continue;
                
                foreach($namespace->functions as $function)
                {
                    $description = addslashes($function->description);
                    $namespace_name = addslashes($namespace->name);
                    
                    $output = "\n";
                    
                    $output .= '// Function ' . $function->name . "\n";
                    $output .= '$function = new FunctionElement(' . "\n";
                    $output .= '    "'.$function->name.'",' . "\n";
                    $output .= '    "'.$description.'"' . "\n";
                    $output .= ');' . "\n\n";
                    
                    foreach($function->overloads as $overload_index=>$overload)
                    {
                        $overload_description = addslashes($overload->description);
                        
                        $output .= '// Overload ' . $overload_index . "\n";
                        $output .= '$overload = new Overload(' . "\n";
                        $output .= '    "'.$overload_description.'"' . "\n";
                        $output .= ');' . "\n";
                        
                        $output .= '$overload->SetReturnType(' . "\n";
                        $output .= '    new ReturnType(' . "\n";
                        $output .= '        "'.$overload->return_type->original_type.'"' . "\n";
                        $output .= '    )' . "\n";
                        $output .= ');' . "\n";
                        
                        if($overload->HasParameters())
                        {
                            foreach($overload->parameters as $parameter)
                            {
                                $parameter_value = addslashes($parameter->default_value);
                                $parameter_description = addslashes($parameter->description);

                                $output .= '$parameter = new Parameter(' . "\n";
                                $output .= '    "'.$parameter->name.'",' . "\n";
                                $output .= '    "'.$parameter->original_type.'",' . "\n";
                                $output .= '    "'.$parameter_value.'",' . "\n";
                                $output .= '    "'.$parameter_description.'"' . "\n";
                                $output .= ');' . "\n";
                                
                                if($parameter->is_array)
                                {
                                    $output .= '$parameter->is_array = true;' . "\n";
                                }
                                
                                $output .= '$overload->AddParameter(' . "\n";
                                $output .= '    $parameter' . "\n";
                                $output .= ');' . "\n";
                            }
                        }
                        
                        $output .= '$function->AddOverload($overload);' . "\n\n";
                    }
                    
                    $output .= '$symbols->AddFunction(' . "\n";
                    $output .= '    $function,' . "\n";
                    $output .= '    "'.$header->name.'",' . "\n";
                    $output .= '    "'.$namespace_name.'"' . "\n";
                    $output .= ');' . "\n\n";
                    
                    fwrite($output_file, $output);
                }
            }
        }
        
        fclose($output_file);
    }
706132
def get_function_body(self, func_indent):
        """"""
        cursor = self.code_editor.textCursor()
        line_number = cursor.blockNumber() + 1
        number_of_lines = self.code_editor.blockCount()
        body_list = []

        for idx in range(number_of_lines - line_number + 1):
            text = to_text_string(cursor.block().text())
            text_indent = get_indent(text)

            if text.strip() == '':
                pass
            elif len(text_indent) <= len(func_indent):
                break

            body_list.append(text)

            cursor.movePosition(QTextCursor.NextBlock)

        return '\n'.join(body_list)
795986
def function_to_serializable_representation(fn):
    
    if type(fn) not in (FunctionType, BuiltinFunctionType):
        raise ValueError(
            "Can't serialize %s : %s, must be globally defined function" % (
                fn, type(fn),))

    if hasattr(fn, "__closure__") and fn.__closure__ is not None:
        raise ValueError("No serializable representation for closure %s" % (fn,))

    return {"__module__": get_module_name(fn), "__name__": fn.__name__}
1231066
def _wrap_functions(self, client):
        

        def wrap(fn):
            def wrapper(*args, **kwargs):
                """Simple wrapper for to catch dead clients."""
                try:
                    return fn(*args, **kwargs)
                except (ConnectionError, TimeoutError):  # TO THE PENALTY BOX!
                    self._penalize_client(client)
                    raise

            return functools.update_wrapper(wrapper, fn)

        for name in dir(client):
            if name.startswith("_"):
                continue
            # Some things aren't wrapped
            if name in ("echo", "execute_command", "parse_response"):
                continue
            obj = getattr(client, name)
            if not callable(obj):
                continue
            log.debug("Wrapping %s", name)
            setattr(client, name, wrap(obj))
724467
public static function getReturnTypeFromCallMap($function_id)
    {
        $call_map_key = strtolower($function_id);

        $call_map = self::getCallMap();

        if (!isset($call_map[$call_map_key])) {
            throw new \InvalidArgumentException('Function ' . $function_id . ' was not found in callmap');
        }

        if (!$call_map[$call_map_key][0]) {
            return Type::getMixed();
        }

        $call_map_type = Type::parseString($call_map[$call_map_key][0]);

        if ($call_map_type->isNullable()) {
            $call_map_type->from_docblock = true;
        }

        return $call_map_type;
    }
325851
def visit_FunctionDef(self, node):
        """"""
        # [[[cog
        # cog.out("print(pcolor('Enter function visitor', 'magenta'))")
        # ]]]
        # [[[end]]]
        in_class = self._in_class(node)
        decorator_list = [
            dobj.id if hasattr(dobj, "id") else dobj.attr
            for dobj in node.decorator_list
            if hasattr(dobj, "id") or hasattr(dobj, "attr")
        ]
        node.decorator_list = []
        # Callable can be:
        # a) A class property defined via decorated methods
        # b) A class method
        # c) A function
        # Get callable information (name, line number, etc.)
        action = (
            "getter"
            if "property" in decorator_list
            else (
                "setter"
                if "setter" in decorator_list
                else ("deleter" if "deleter" in decorator_list else None)
            )
        )
        element_type = "meth" if in_class else "func"
        element_full_name = self._pop_indent_stack(node, element_type, action=action)
        code_id = (self._fname, node.lineno)
        self._processed_line = node.lineno
        self._callables_db[element_full_name] = {
            "name": element_full_name,
            "type": element_type,
            "code_id": code_id,
            "last_lineno": None,
        }
        self._reverse_callables_db[code_id] = element_full_name
        # [[[cog
        # code = """
        # print(
        #     pcolor(
        #         'Visiting callable {0}  @ {1}'.format(
        #             element_full_name, code_id[1]
        #         ),
        #         'green'
        #     )
        # )
        # print(pcolor('    in_class = {}'.format(in_class), 'yellow'))
        # """
        # cog.out(code)
        # ]]]
        # [[[end]]]
        self.generic_visit(node)
1162607
private function formatFunction(ReflectionFunctionAbstract $function): string
    {
        $s = '';
        if ($function instanceof ReflectionMethod && $function->getDeclaringClass()) {
            $s .= $function->getDeclaringClass()->getName() . '::';
        }

        $s .= $function->getName();

        return $s;
    }
92129
function makeFunctionWrapper(original, functionName) {
  //log("wrap fn: " + functionName);
  var f = original[functionName];
  return function() {
    //log("call: " + functionName);
    var result = f.apply(original, arguments);
    return result;
  };
}
1089237
def wrapped_help_text(wrapped_func):
    
    def decorator(wrapper_func):
        """The decorator.

        Parameters
        ----------
        f : callable
            The wrapped function.

        """
        wrapper_func.__doc__ = ('This method wraps the following method:\n\n' +
                                pydoc.text.document(wrapped_func))
        return wrapper_func
    return decorator
204466
private static function createProxyCode(\ReflectionFunction $function): string
    {
        $param = paramsOf($function);
        $return = true;
        $returnType = determineReturnTypeOf($function);
        if ($returnType === ': void') {
            $return = false;
        }

        $code  = sprintf(
                    "class %sCallMapProxy extends \bovigo\callmap\FunctionProxy{\n"
                    . "    protected \$paramNames = %s;\n"
                    . "    public function preventParentCalls(): self\n"
                    . "    {\n"
                    . "        \$this->parentCallsAllowed = false;\n"
                    . "        return \$this;\n"
                    . "    }\n"
                    . "    public function __invoke(%s)%s {\n"
                    . "        %s\$this->handleFunctionCall(func_get_args());\n"
                    . "    }\n"
                    . "    protected \$returnVoid = %s;"
                    . "}\n",
                    ucfirst($function->getShortName()),
                    var_export($param['names'], true),
                    $param['string'],
                    determineReturnTypeOf($function),
                    $return ? 'return ' : '',
                    $return ? 'false' : 'true'
        );
        if ($function->inNamespace()) {
            return sprintf(
                    "namespace %s {\n%s}\n",
                    $function->getNamespaceName(),
                    $code
            );
        }

        return $code;
    }
502527
private function getCurloptHeaderFunction() : callable
    {
        return function($ch, $data){
            $str = trim($data);
            if('' !== $str){
                if(strpos(strtolower($str), 'http/') === 0){
                    $status_line                                        = $str;
                    @list($http_version, $http_code, $reason_phrase)    = explode(' ', $status_line, 3);
                    $this->Response = $this->Response->withStatus((int) $http_code, (string) $reason_phrase);
                    $this->Response = $this->Response->withProtocolVersion((string) $http_version);
                }else{
                    $header_line            = $str;
                    @list($name, $value)    = explode(':', $header_line, 2);
                    $this->Response         = $this->Response->withAddedHeader(trim((string) $name), trim((string) $value));
                }
            }
            return strlen($data);
        };
    }
928629
protected function createBlocksFromMethodData($methods_data) {
    foreach ($methods_data as $interface_method_name => $interface_method_data) {
      $function_code = [];
      $function_doc = $this->docBlock('{@inheritdoc}');
      $function_code = array_merge($function_code, $function_doc);

      // Trim the semicolon from the end of the interface method.
      $method_declaration = substr($interface_method_data['declaration'], 0, -1);

      $function_code[] = "$method_declaration {";
      // Add a comment with the method's first line of docblock, so the user
      // has something more informative than '{@inheritdoc}' to go on!

      // Babysit documentation that is missing a final full stop, so PHP
      // Codesniffer doesn't complain in our own tests, and we output correctly
      // formatted code ourselves.
      // (This can happen either if the full stop is missing, or if the first
      // line overruns to two, in which case our analysis will have truncated
      // the sentence.)
      if (substr($interface_method_data['description'], -1) != '.') {
        $interface_method_data['description'] .= '.';
      }

      $function_code[] = '  // ' . $interface_method_data['description'];
      $function_code[] = '}';

      // Add to the functions section array for the parent to merge.
      $this->functions[] = $function_code;
    }
  }
1257346
public static function compose($functionA, $functionB)
    {
        return function ($input) use ($functionA, $functionB) {
            return Functions::call($functionA, Functions::call($functionB, $input));
        };
    }