Generates the markup for an XML element.

@param  string  $method     Name of the XML element.
@param  array   $arguments  Expected length is 0 or 1 (content).
@return string
333756
public static function __callstatic($method, $arguments)
	{
		$content = count($arguments) ? $arguments[0] : null;
		return self::createSub($method, $content);
	}
204217
private function generateCommand($name, \ReflectionMethod $method, $token = null)
    {
        $methodName = $this->transformer->transform($method->getName());

        $command = new Command(strtolower($name . ':' . $methodName));

        $factory  = DocBlockFactory::createInstance();
        $docBlock = $factory->create($method);

        $command->setDefinition($this->buildDefinition($method, $docBlock, $token));
        $command->setDescription($docBlock->getSummary());
        $command->setCode($this->createCode($name, $method));

        return $command;
    }
330662
private function callFindAllBy(string $method, array $arguments)
    {
        $whereByWithUpper = lcfirst(substr($method, 9, mb_strlen($method)));
        $whereBy = Str::convertCamelCaseToSnakeCase($whereByWithUpper);

        return $this->where($whereBy, '=', $arguments[0])->findAll();
    }
669769
private function generateFeed($method)
    {
        $session = $this->session->get('news_feed_updater');

        if (!\is_array($session) || empty($session)) {
            return;
        }

        $feedGenerator = new FeedGenerator();

        foreach ($session as $id) {
            $feedGenerator->$method($id);
        }

        (new Automator())->generateSitemap();

        $this->session->set('news_feed_updater', null);
    }
409510
public function createCall($method, $params = array())
	{
		$params = array_values($params);

		if ($this->isAsync())
		{
			$output = "_gaq.push(['{$method}',";
			$output .= substr(json_encode($params), 1, -1);
			$output .= ']);';
		}
		else
		{
			$output = "pageTracker.{$method}(";
			$output .= substr(json_encode($params), 1, -1);
			$output .= ');';
		}

		return $output;
	}
979779
public function handle(string $method, array $arguments)
    {
        $upMethod = strtoupper($method);
        $context  = array_shift($arguments);

        if (in_array($upMethod, self::$asynCommand)) {
            $sql = '';
            if ($upMethod == 'GO') {
                if (!empty($arguments[1])) {
                    $sql = trim($arguments[1]);
                } else {
                    $sql = $this->getDBQueryBuilder($context)->getStatement(false);
                }
            }

            if (!empty($sql) && empty($arguments[0]) && !empty($this->slaves)) {
                if (stripos($sql, 'SELECT') === 0 || stripos($sql, 'SHOW') === 0) {
                    $rand     = array_rand($this->slaves);
                    $poolName = $this->slaves[$rand];
                } else {
                    $poolName = $this->master;
                }
            } else {
                $poolName = $this->master;
            }

            $pool = getInstance()->getAsynPool($poolName);
            if ($pool == null) {
                throw new Exception("mysql pool $poolName not register!");
            }
            $this->getDBQueryBuilder($context)->mysqlPool = $pool;
            if (method_exists($this->getDBQueryBuilder(), $method)) {
                return $this->getDBQueryBuilder($context)->{$method}(...$arguments);
            } else {
                array_push($arguments, $context);
                return $this->getDBQueryBuilder($context)->mysqlPool->{$method}(...$arguments);
            }
        }

        $this->getDBQueryBuilder($context)->{$method}(...$arguments);

        return $this->__wrapper;
    }
959486
protected function apply($method, $arguments)
    {
        if (! method_exists($this, $method))
        {
           throw new \BadMethodCallException(sprintf('Method %s do not exists', $method));
        }

        switch (count($arguments))
        {
            case 0:
                return $this->{$method}();

            case 1:
                return $this->{$method}($arguments[0]);

            case 2:
                return $this->{$method}($arguments[0], $arguments[1]);

            case 3:
                return $this->{$method}($arguments[0], $arguments[1], $arguments[2]);

            default:
                return call_user_func_array(array($this, $method), $arguments);
        }
    }
941474
protected function generateDocForMethod($method): SmdService
    {
        $result = new SmdService();

        $docs = $method->getDocComment();

        if (!$docs) {
            $result->name = $this->getMethodName($method);
            $result->parameters = $this->getMethodParameters($method);
            $result->return = $this->getMethodReturn($method);
        } else {
            $docBlock = $this->docFactory->create($docs);

            $result->name = $this->getMethodName($method, $docBlock);
            $result->description = $this->getMethodDescription($docBlock);

            if ($docBlock->hasTag(self::API_METHOD_DEPRECATED)) {
                $result->deprecated = true;
            }

            if ($docBlock->hasTag(self::API_METHOD_NOTE)) {
                $result->note = (string)$docBlock->getTagsByName(self::API_METHOD_NOTE)[0];
            }

            if ($docBlock->hasTag(self::API_METHOD_WARNING)) {
                $result->warning = (string)$docBlock->getTagsByName(self::API_METHOD_WARNING)[0];
            }

            if ($docBlock->hasTag(self::API_METHOD_REQUEST_EXAMPLE)) {
                $result->requestExample = (string)$docBlock->getTagsByName(self::API_METHOD_REQUEST_EXAMPLE)[0];
            }

            if ($docBlock->hasTag(self::API_METHOD_RESPONSE_EXAMPLE)) {
                $result->responseExample = (string)$docBlock->getTagsByName(self::API_METHOD_RESPONSE_EXAMPLE)[0];
            }

            $objects = [];
            /** @var ApiEnum[] $tags */
            $tags = $docBlock->getTagsByName(self::API_ENUM);
            foreach ($tags as $tag) {
                $objects = $this->getDocForEnum($tag, $objects);
            }

            /** @var ApiObject[] $tags */
            $tags = $docBlock->getTagsByName(self::API_OBJECT);
            foreach ($tags as $tag) {
                $objects = $this->getDocForObject($tag, $objects);
            }
            if (!empty($objects)) {
                $result->objects = $objects;
            }

            $result->parameters = $this->getMethodParameters($method, $docBlock);
            $result->return = $this->getMethodReturn($method, $docBlock);

            /** @var ApiReturn[] $returnParams */
            $returnParams = $docBlock->getTagsByName(self::API_METHOD_RETURN_PARAM);

            $return = [];
            foreach ($returnParams as $param) {
                $return = $this->getExtendedReturns($param, $return);
            }

            if (!empty($return)) {
                $result->returnParameters = $return;
            }

            $tags = array_map(function ($value) {
                return (string)$value;
            }, $docBlock->getTagsByName(self::API_METHOD_TAG));

            if (!empty($tags)) {
                $result->tags = $tags;
            }
        }

        return $result;
    }
26307
protected function invokeMethod($object, $method, array $arguments = array())
    {
        return $this->getReflectionMethod($object, $method)->invokeArgs($object, $arguments);
    }
61354
protected static function _generateMethod($method, $callParent = false)
    {
        $result = join(' ', Reflection::getModifierNames($method->getModifiers()));
        $result = preg_replace('/abstract\s*/', '', $result);
        $name = $method->getName();
        $parameters = static::_generateSignature($method);
        $type = static::_generateReturnType($method);
        $body = "{$result} function {$name}({$parameters}) {$type}{";
        if ($callParent) {
            $parameters = static::_generateParameters($method);
            $return = 'return ';
            if ($method->isConstructor() || $method->isDestructor()) {
                $return = '';
            }
            $body .= "{$return}parent::{$name}({$parameters});";
        }
        return $body . "}";
    }
288119
protected function getMethodName($method, $docBlock = null): string
    {
        if ($docBlock !== null && $docBlock->hasTag(self::API_METHOD_NAME)) {
            $tags = $docBlock->getTagsByName(self::API_METHOD_NAME);

            return (string)$tags[0];
        }

        $controllerName = $method->getDeclaringClass();

        if (!empty($this->server->endpoint)) {
            return $method->getName();
        }

        return $this->getShortNameForController($controllerName->getName()) . '_' . $method->getName();
    }
1065577
public function evaluate($method, $arguments = array())
    {
        $callable = $this->mapper->getCallable($method);
        $arguments = $this->mapper->getArguments($callable, $arguments);

        return $this->execute($callable, $arguments);
    }
1236026
public function call(string $method, array $arguments): ResponseInterface
    {
        try {
            return $this->__soapCall($method, $arguments, null, $this->getHeader());
        } catch (\Exception $e) {
            $exception = new ClientException($e->getMessage(), $e->getCode(), $e);

            if ($this->debug) {
                $exception->request = ClientException::formatXml($this->__getLastRequest());
                $exception->response = ClientException::formatXml($this->__getLastResponse());
            }

            throw $exception;
        }
    }
1221213
protected function buildMethod(ReflectionMethod $method)
    {
        $argString = "";
        $paramString = "";
        $returnString = "";
        foreach ($method->getParameters() as $value) {
            $argString .= "\${$value->getName()}, ";
            $paramString .= $this->getParamString($value);
        }

        $methodReturn = $method->getReturnType();
        if (!is_null($methodReturn)) {
            if (!$methodReturn->isBuiltin()) {
                $this->useList[] = sprintf("%s", $methodReturn);
                $arr = explode("\\", $methodReturn);
                $methodReturn = array_pop($arr);
            }

            $returnString = ": {$methodReturn}";
        }

        $argString = trim($argString, ", ");
        $paramString = trim($paramString, ", ");
        $replaces = array(
            $method->getDocComment(),
            $method->getName(),
            $paramString,
            $returnString,
            $argString
        );
        return str_replace(self::METHOD_TPL_SEARCHES, $replaces, $this->template->getMethodTemplate());
    }
1076838
public static function generateDoxygenDocumentation()
	{
		foreach (static::$methods as $methodName => $m) {
			@ list($realMethod, $buffer, $label) = $m;
			echo "/**\n";
			echo "@memberof ", get_called_class(), "\n";
			if ($realMethod == 'setFlag') {
				echo "@fn $methodName()\n";
			} else {
				echo "@fn $methodName(\$sql_statement, ...)\n";
				echo "@param \$sql_statement SQL statement (a fragment of SQL query) with placeholders.\n";
				echo "@param ... Values of placeholders (when positional placeholders are used).\n";
			}
			echo "@public\n";
			if ($realMethod == 'setFlag') {
				echo "@brief Sets content of buffer `$buffer` to `$label`.\n";
			} else if (substr($realMethod, 0, 3) == 'add') {
				if ($label) {
					echo "@brief Appends `\$sql_statement` prefixed with `$label` to buffer `$buffer`.\n";
				} else {
					echo "@brief Appends `\$sql_statement` to buffer `$buffer`.\n";
				}
			} else {
				if ($label) {
					echo "@brief Replaces content of buffer `$buffer` with `\$sql_statement` prefixed with `$label`.\n";
				} else {
					echo "@brief Replaces content of buffer `$buffer` with `\$sql_statement`.\n";
				}
			}
			echo "\n";
			echo "@note This method is generated from FlupdoBuilder::\$methods array. See compileQuery() method for buffer usage.\n";
			echo "*/\n";
			echo "\n";
		}
	}
117307
public function evaluate($method, $arguments)
    {
        $this->validate($method, $arguments);
        return $this->evaluator->evaluate($method, $arguments);
    }
324929
protected function render($content, $method, $appendTags = ['body'])
    {
        $appendHtml = $this->renderBuffer(function () use ($method) {
            $requestUri = Arr::get($_SERVER, 'REQUEST_URI');
            Arr::set($_SERVER, 'REQUEST_URI', '');
            call_user_func([$this->bar, $method]);
            Arr::set($_SERVER, 'REQUEST_URI', $requestUri);
        });

        $appendTags = array_unique($appendTags);

        foreach ($appendTags as $appendTag) {
            $pos = strripos($content, '</'.$appendTag.'>');

            if ($pos !== false) {
                return substr_replace($content, $appendHtml, $pos, 0);
            }
        }

        return $content.$appendHtml;
    }