Invoke service

@param Invocation $invocation
@return mixed
@throws InitiallyRpcException
761532
public function invoke(Invocation $invocation)
    {
        $request = new Request();
        $request->setInterface($this->interface);
        $request->setMethodName($invocation->getMethodName());
        $request->setArguments($invocation->getArguments());
        $transport = Transport::factory($this->config->getTransport());
        if (!($transport instanceof Transport)) {
            throw new InitiallyRpcException("missing transport");
        }

        return $transport->send($request);
    }
850799
public function alterTextarea(MethodInvocation $invocation)
    {
        $helper = $invocation->getThis();
        list($fieldName, $options) = array_pad($invocation->getArguments(), 2, null);

        if (!empty($options['class']) &&
            strpos($options['class'], 'ckeditor') !== false &&
            $helper instanceof FormHelper
        ) {
            static::$_counter++;
            $editorId = 'ck-editor-' . static::$_counter;
            $options['class'] .= ' ' . $editorId;
            $view = $this->getProperty($helper, '_View');

            if (!static::$_scriptsLoaded) {
                static::$_scriptsLoaded = true;
                $filebrowserBrowseUrl = $view->Url->build(['plugin' => 'Wysiwyg', 'controller' => 'finder']);
                $view->Html->script('Wysiwyg./ckeditor/ckeditor.js', ['block' => true]);
                $view->Html->script('Wysiwyg./ckeditor/adapters/jquery.js', ['block' => true]);
                $view->Html->scriptBlock('$(document).ready(function () {
                    CKEDITOR.editorConfig = function(config) {
                        config.filebrowserBrowseUrl = "' . $filebrowserBrowseUrl . '";
                    };
                });', ['block' => true]);
                $this->_includeLinksToContents($view);
            }
        }

        $this->setProperty($invocation, 'arguments', [$fieldName, $options]);

        return $invocation->proceed();
    }
428
function invoke() {
        parent::invoke();

        $result = true;

        // Set own core attributes
        $this->does_generate = ACTION_NONE;

        // These are always here
        global $CFG, $XMLDB;

        // Do the job, setting result as needed

        // Get the dir containing the file
        $dirpath = required_param('dir', PARAM_PATH);
        $dirpath = $CFG->dirroot . $dirpath;

        // Get the original dir and delete some elements
        if (!empty($XMLDB->dbdirs)) {
            if (isset($XMLDB->dbdirs[$dirpath])) {
                $dbdir = $XMLDB->dbdirs[$dirpath];
                if ($dbdir) {
                    unset($dbdir->xml_file);
                    unset($dbdir->xml_loaded);
                    unset($dbdir->xml_changed);
                    unset($dbdir->xml_exists);
                    unset($dbdir->xml_writeable);
                }
            }
        }
        // Get the edited dir and delete it completely
        if (!empty($XMLDB->editeddirs)) {
            if (isset($XMLDB->editeddirs[$dirpath])) {
                unset($XMLDB->editeddirs[$dirpath]);
            }
        }

        // Launch postaction if exists (leave this here!)
        if ($this->getPostAction() && $result) {
            return $this->launch($this->getPostAction());
        }

        // Return ok if arrived here
        return $result;
    }
603711
@Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        long start = System.currentTimeMillis();
        Object result = invocation.proceed();
        profilingContainer.register(group, System.currentTimeMillis() - start);
        return result;
    }
106758
public function aroundArrayFunctions(FunctionInvocation $invocation)
    {
        echo 'Calling Around Interceptor for ',
            $invocation,
            ' with arguments: ',
            json_encode($invocation->getArguments()),
            PHP_EOL;

        return $invocation->proceed();
    }
193561
private function preProcess(AbstractInvoke $invoke): AbstractInvoke
    {
        $result = $this->preProcess->handle(new ProcessorContainer($this, $invoke));

        if ($result instanceof ProcessorContainer) {
            return $result->getInvoke();
        }

        throw new \RuntimeException();
    }
1191423
public static function server()
    {
        $configFile = ServerApp::getInstance()->getConfigFile();
        $content = file_get_contents($configFile);
        $config = json_decode($content, true);
        if (!is_array($config)) {
            throw new InitiallyRpcException("Server config error: format error");
        } else if (!isset($config["transport"])) {
            throw new InitiallyRpcException("Server config error: undefined transport");
        }

        $serverConfig = new Server();
        $serverConfig->setTransport($config["transport"]);
        if (isset($config["services"]) && is_array($config["services"]) && !empty($config["services"])) {
            foreach ($config["services"] as $key => $value) {
                if (!is_array($value)) {
                    throw new InitiallyRpcException("Server config error: service format error");
                } else if (!isset($value["interface"])) {
                    throw new InitiallyRpcException("Server config error: undefined interface");
                } else if (!isset($value["reference"])) {
                    throw new InitiallyRpcException("Server config error: undefined reference");
                }

                $service = new Service();
                $service->setInterface($value["interface"]);
                $service->setReference($value["reference"]);
                $serverConfig->addService($service);
            }
        }

        return $serverConfig;
    }
442272
@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		if (DISABLED || !SERVICES_COUNTER.isDisplayed()) {
			return method.invoke(facade, args);
		}
		// nom identifiant la requête
		final String requestName = getRequestName(method);

		return invokeTarget(facade, method, args, requestName);
	}
509447
public function invoke(MethodInvocation $invocation)
    {
        $ro = $invocation->proceed();
        if (! $ro instanceof ResourceObject) {
            throw new ReturnValueIsNotResourceObjectException(\get_class($invocation->getThis()));
        }

        if ($ro->code >= Code::BAD_REQUEST) {
            return $this;
        }

        foreach ($this->commands as $command) {
            $command->command($invocation, $ro);
        }

        return $ro;
    }
124644
public void invoke(BurlapInput in, BurlapOutput out)
        throws Exception
    {
        invoke(_service, in, out);
    }
705445
public final Object invoke(MethodInvocation invocation) throws Throwable {
		final Split split = stopwatchSource.start(invocation);
		try {
			return processInvoke(invocation, split);
		} finally {
			split.stop();
		}
	}
838170
public function initInvokableServices()
    {
        $config = $this->getConfig();
        if (!isset($config['service_manager'])) {
            return $this;
        }
        
        $smConfig = $config['service_manager'];
        if (!isset($smConfig['invokables'])) {
            return $this;
        }
        $invokables = $smConfig['invokables']->toArray();
        $shared     = isset($smConfig['shared']) ? $smConfig['shared']->toArray() : [];
        foreach ($invokables as $serviceName => $serviceClassName) {
            if (!is_string($serviceClassName)) {
                $msg = sprintf('Config for invokable service "%s" must be string data type', $serviceName);
                throw new Exception\UnexpectedValueException($msg);
            }
            $isShare = isset($shared[$serviceName]) ? (bool) $shared[$serviceName] : true;
            $this->diFactory->set($serviceName, $serviceClassName, $isShare);
        }
        return $this;
    }
1185920
public Object invoke(MethodInvocation invocation) throws Throwable {
		ProxyMethodInvocation pmi = (ProxyMethodInvocation) invocation;
		TargetMetaRequest targetMetaRequest = targetMetaRequestsHolder.getTargetMetaRequest();
		TargetMetaDef targetMetaDef = targetMetaRequest.getTargetMetaDef();
		if (targetMetaDef.isEJB())
			return invocation.proceed();

		if (!isStateful(targetMetaDef)) {
			// Debug.logVerbose("[JdonFramework] target service is not Stateful: "
			// + targetMetaDef.getClassName() +
			// " StatefulInterceptor unactiive", module);
			return invocation.proceed();
		}
		Debug.logVerbose("[JdonFramework] enter StatefulInterceptor", module);
		Object result = null;
		try {
			ComponentVisitor cm = targetMetaRequest.getComponentVisitor();
			targetMetaRequest.setVisitableName(ComponentKeys.TARGETSERVICE_FACTORY);
			Debug.logVerbose(ComponentKeys.TARGETSERVICE_FACTORY + " in action (Stateful)", module);
			Object targetObjRef = cm.visit();
			pmi.setThis(targetObjRef);
			result = invocation.proceed();
		} catch (Exception ex) {
			Debug.logError("[JdonFramework]StatefulInterceptor error: " + ex, module);
		}
		return result;
	}
1140785
public function send(Request $request)
    {
        $interface = $request->getInterface();
        $service = ConfigFactory::getClient()->getService($interface);
        $url = $service->getUrl();

        $requestRaw = Formatter::serialize($request);
        $responseRaw = $this->protocol->sendData($url, $requestRaw);
        $response = @Formatter::unserialize($responseRaw);
        if (!($response instanceof Response)) {
            LoggerProxy::getInstance()->error("illegal response", array($responseRaw));
            throw new InitiallyRpcException("illegal response");
        } elseif ($response->isHasException()) {
            $exception = $response->getException();
            if (is_object($exception) && $exception instanceof Exception) {
                throw $exception;
            } else if (is_string($exception)) {
                if (class_exists($exception)) {
                    throw new $exception($response->getExceptionMessage());
                } else {
                    throw new InitiallyRpcException($response->getExceptionMessage());
                }
            }
        }

        return $response->getResult();
    }
304246
protected function invokeRegisterAction($arg) {
        list($class, $action) = explode('@', $arg);
        if (!class_exists($class)) {
            return $this->invokeController('Service\\'.app('app.module').'\\'.$class, $action);
        }
        $reflectionClass = new ReflectionClass( $class );
        $method = $reflectionClass->getMethod($action);

        $parameters = $method->getParameters();
        $arguments = array();
        foreach ($parameters as $param) {
            $arguments[] = app('request')->get($param->getName());
        }
        return call_user_func_array(array(new $class, $action), $arguments);
    }
952349
private function invocationDomain(ReflectionInvocation $invocation): string
    {
        //Translation using default bundle
        $domain = $this->config->getDefaultDomain();

        if ($invocation->getName() === 'say') {
            //Let's try to confirm domain
            $domain = $this->config->resolveDomain($invocation->getClass());
        }

        //`l` and `p`, `say` functions
        $argument = null;
        switch (strtolower($invocation->getName())) {
            case 'say':
            case 'l':
                if ($invocation->countArguments() >= 3) {
                    $argument = $invocation->getArgument(2);
                }
                break;
            case 'p':
                if ($invocation->countArguments() >= 4) {
                    $argument = $invocation->getArgument(3);
                }
        }

        if (!empty($argument) && $argument->getType() === ReflectionArgument::STRING) {
            //Domain specified in arguments
            $domain = $this->config->resolveDomain($argument->stringValue());
        }

        return $domain;
    }
897864
function invoke() {

        global $SESSION;

        // Sesskey protection
        if ($this->sesskey_protected) {
            require_sesskey();
        }

        // If we are used any dir, save it in the lastused session object
        // Some actions can use it to perform positioning
        if ($lastused = optional_param ('dir', NULL, PARAM_PATH)) {
            $SESSION->lastused = $lastused;
        }

        $this->postaction = optional_param ('postaction', NULL, PARAM_ALPHAEXT);
        // Avoid being recursive
        if ($this->title == $this->postaction) {
            $this->postaction = NULL;
        }
    }