CI_Xmlrpcs::_execute PHP Метод

_execute() защищенный Метод

Executes the Method
protected _execute ( $m ) : mixed
Результат mixed
    protected function _execute($m)
    {
        $methName = $m->method_name;
        // Check to see if it is a system call
        $system_call = strpos($methName, 'system') === 0;
        if ($this->xss_clean === FALSE) {
            $m->xss_clean = FALSE;
        }
        //-------------------------------------
        // Valid Method
        //-------------------------------------
        if (!isset($this->methods[$methName]['function'])) {
            return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
        }
        //-------------------------------------
        // Check for Method (and Object)
        //-------------------------------------
        $method_parts = explode('.', $this->methods[$methName]['function']);
        $objectCall = isset($method_parts[1]) && $method_parts[1] !== '';
        if ($system_call === TRUE) {
            if (!is_callable(array($this, $method_parts[1]))) {
                return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
            }
        } elseif ($objectCall && !is_callable(array($method_parts[0], $method_parts[1])) or !$objectCall && !is_callable($this->methods[$methName]['function'])) {
            return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']);
        }
        //-------------------------------------
        // Checking Methods Signature
        //-------------------------------------
        if (isset($this->methods[$methName]['signature'])) {
            $sig = $this->methods[$methName]['signature'];
            for ($i = 0, $c = count($sig); $i < $c; $i++) {
                $current_sig = $sig[$i];
                if (count($current_sig) === count($m->params) + 1) {
                    for ($n = 0, $mc = count($m->params); $n < $mc; $n++) {
                        $p = $m->params[$n];
                        $pt = $p->kindOf() === 'scalar' ? $p->scalarval() : $p->kindOf();
                        if ($pt !== $current_sig[$n + 1]) {
                            $pno = $n + 1;
                            $wanted = $current_sig[$n + 1];
                            return new XML_RPC_Response(0, $this->xmlrpcerr['incorrect_params'], $this->xmlrpcstr['incorrect_params'] . ': Wanted ' . $wanted . ', got ' . $pt . ' at param ' . $pno . ')');
                        }
                    }
                }
            }
        }
        //-------------------------------------
        // Calls the Function
        //-------------------------------------
        if ($objectCall === TRUE) {
            if ($method_parts[0] === 'this' && $system_call === TRUE) {
                return call_user_func(array($this, $method_parts[1]), $m);
            } elseif ($this->object === FALSE) {
                return get_instance()->{$method_parts}[1]($m);
            } else {
                return $this->object->{$method_parts}[1]($m);
            }
        } else {
            return call_user_func($this->methods[$methName]['function'], $m);
        }
    }