包围时只能添加一个以最后一个为准

@param      $clazz
@param      $actions
@param      $aroundClazz
@param      $warpAction
@param null $call
173447
public static function around($clazz, $actions, $aroundClazz, $warpAction, $call = null) {
        $actions = static::actionsBuild($actions);
        if (!isset(static::$aroundActions[ $clazz ])) {
            static::$aroundActions[ $clazz ] = array();
        }
        $info = array('methods' => $actions[ 'methods' ],
                      'class' => $aroundClazz,
                      'action' => $warpAction,
                      "call" => $call,
                      "range" => static::$range);
        static::$range++;
        static::$aroundActions[ $clazz ][ $actions[ 'type' ] ] = array();
        static::$aroundActions[ $clazz ][ $actions[ 'type' ] ][] = $info;
    }
1024739
public static function getAroundActions($clazz, $action) {
        $actions = null;
        if (isset(static::$aroundActions[ $clazz ]) && static::$aroundActions[ $clazz ]) {
            $actions = static::buildActions(static::$aroundActions[ $clazz ], $action);
        }
        if ($actions && count($actions) > 0) {
            return $actions[ 0 ];
        }
        return null;
    }
1107644
public static function executeCallableRoute(callable $call, $route = '')
    {
        call_user_func($call);
        Cml::$debug && Debug::addTipInfo(Lang::get('_CML_EXECUTION_ROUTE_IS_', "callable route:{{$route}}", Config::get('url_model')));
        Cml::cmlStop();
    }
1212245
private void doAction(List<ActionBlock> actions) throws ActionException {
        try {
            actions.get(nextStep).execute();
        } catch (ActionException e) {
            throw e;
        } catch (Exception e) {
            throw new ActionException("Exception raised by step: " + nextStep, e);
        }
    }
477910
public static function call($method, $params, $url, $publickey, $oRemoteApp = null)
        {

            $response = "";
            try {
                $sOldErrorhandler = set_error_handler('Slashworks\AppBundle\Services\Api::errorHandler');

                if(!self::$_container){
                    throw new \InvalidArgumentException("Container not given...");
                }


                if (!is_scalar($method)) {
                    throw new \Exception('Method name has no scalar value');
                }

                // check
                if (is_array($params)) {
                    // no keys
                    $params = array_values($params);
                } else {
                    throw new \Exception('Params must be given as array');
                }

                // prepares the request
                $request = array(
                    'method' => $method,
                    'params' => $params,
                    'id'     => rand(1, 999)
                );
                $request = json_encode($request);


                $rsa = new \Crypt_RSA();
                $rsa->loadKey($publickey);



                $sAppPath = self::$_container->get('kernel')->getRootDir();
                $sVendorPath = $sAppPath."/../vendor/slashworks/control-bundle/src/Slashworks/";
                $sKeyPath = $sVendorPath."AppBundle/Resources/private/api/keys/server/";

                $conairKey = file_get_contents($sKeyPath . "public.key");
                $aRequest  = array(
                    'pkey' => $conairKey,
                    'data' => base64_encode($rsa->encrypt($request))
                );

                $sRequest = json_encode($aRequest);

                $headers = array(
                    'Content-Type: application/json'
                );

                if ($oRemoteApp->getApiAuthType() == "http-basic") {
                    $sUsername = $oRemoteApp->getApiAuthHttpUser();
                    $sPassword = $oRemoteApp->getApiAuthHttpPassword();
                    if (!empty($sUsername) && !empty($sPassword)) {
                        $headers[] = "Authorization: Basic " . base64_encode($oRemoteApp->getApiAuthHttpUser() . ":" . $oRemoteApp->getApiAuthHttpPassword());
                    }
                }
                $oRequest = curl_init($url);
                curl_setopt($oRequest, CURLOPT_HTTPHEADER, $headers);
                curl_setopt($oRequest, CURLOPT_TIMEOUT, 5);
                curl_setopt($oRequest, CURLOPT_POST, 1);
                curl_setopt($oRequest, CURLOPT_POSTFIELDS, $sRequest);
                curl_setopt($oRequest, CURLOPT_RETURNTRANSFER, true);
                $response    = curl_exec($oRequest);
                $iHttpStatus = curl_getinfo($oRequest, CURLINFO_HTTP_CODE);
                $error = curl_error($oRequest);
                curl_close($oRequest);

                $rawResponse = $response;

                if ($response == "") {
                    throw new \Exception("No content received for call on: ".$url);
                }
                if ($iHttpStatus === 200) {
                    $response = json_decode($response, true);

                    if (!isset($response['data'])) {
                        throw new \Exception("Invalid response format: ".htmlentities($rawResponse));
                    }

                    $privateKey = file_get_contents(__DIR__ . "/../Resources/private/api/keys/server/private.key");
                    $rsa->loadKey($privateKey);
                    $data             = base64_decode($response['data']);
                    $decoded          = $rsa->decrypt($data);
                    $response['data'] = json_decode($decoded, true);
                    if (!is_array($response['data'])) {
                        throw new \Exception("Invalid response format: ".htmlentities($rawResponse));
                    }

                    $response['data']['statuscode'] = $iHttpStatus;
                    if($iHttpStatus !== 200){
                        $response['error'] = true;
                    }


                    ApiLog::create($iHttpStatus, $oRemoteApp->getId(), $decoded);


                    restore_error_handler();

                    return $response['data'];
                } else {

                    ApiLog::create($iHttpStatus, $oRemoteApp->getId(), $response);

                    restore_error_handler();

                    return array(
                        "statuscode" => $iHttpStatus,
                        "result"     => json_encode(array(
                                                        "status"     => false,
                                                        "error"     => true,
                                                        "statuscode" => $iHttpStatus,
                                                        "message"    => $response
                                                    )
                        )
                    );
                }


            } catch (ContextErrorException $e) {

                restore_error_handler();
                ApiLog::create(-1, $oRemoteApp->getId(), $e->getMessage());


                return array(
                    "statuscode" => $iHttpStatus,
                    "result"     => json_encode(array(
                                                    "status"     => false,
                                                    "error"     => true,
                                                    "statuscode" => -1,
                                                    "message"    => $e->getMessage()
                                                )
                    )
                );
            } catch (\Exception $e) {


                restore_error_handler();
                ApiLog::create(-1, $oRemoteApp->getId(), $e->getMessage());

                return array(
                    "statuscode" => 500,
                    "result"     => json_encode(array(
                                                    "status"     => false,
                                                    "error"     => true,
                                                    "statuscode" => -1,
                                                    "message"    => $e->getMessage()
                                                )
                    )
                );
            }
        }
917777
public static void forEachSuperClass( Class<?> clazz, ClassAction action ) {
        try {
            action.act( clazz );
            Class<?> superclass = clazz.getSuperclass();
            if( superclass != null ) {
                forEachSuperClass( superclass, action );
            }
        } catch( Exception e ) {
            throw Throwables.propagate( e );
        }

    }
1109340
private function repackageCallWithNewArguments(Call $call, array $newArguments)
    {
        if ($call instanceof DefinitionCall) {
            return $this->repackageDefinitionCall($call, $newArguments);
        }

        if ($call instanceof TransformationCall) {
            return $this->repackageTransformationCall($call, $newArguments);
        }

        throw new UnsupportedCallException(
            sprintf(
                'ServicesResolver can not filter `%s` call.',
                get_class($call)
            ), $call
        );
    }
813079
private function ensureSameGrouping(array $actions, ModelIdInterface $after = null)
    {
        $environment  = $this->getEnvironment();
        $groupingMode = ViewHelpers::getGroupingMode($environment);
        if ($groupingMode && $after && $after->getId()) {
            // when pasting after another item, inherit the grouping field
            $groupingField = $groupingMode['property'];
            $previous      = $this->modelCollector->getModel($after);
            $groupingValue = $previous->getProperty($groupingField);

            foreach ($actions as $action) {
                /** @var ModelInterface $model */
                $model = $action['model'];
                $model->setProperty($groupingField, $groupingValue);
            }
        }
    }
482886
public function dispatch($call = null)
    {
        $command = $this->routes->get($this->arguments->getCommand(1), false);
        if ($this->routes->get($call, false)) {
            $command = $this->routes->get($call, false);
        }
        if ($command) {
            $handler = new ClassMethodHandler($command, $this->arguments);
            return $handler->call($this->arguments);
        }
        throw new CommandNotFoundException(sprintf('Command %s is not registered.', $call));
    }
748439
private function processOptionals(array &$expression, Call $call, CompilationContext $context)
    {
        $flags = null;
        $offset = null;

        $offsetParamOffset = 4;
        if (isset($expression['parameters'][4]) && 'int' === $expression['parameters'][4]['parameter']['type']) {
            $offset = $expression['parameters'][4]['parameter']['value'].' ';
            unset($expression['parameters'][4]);
        }

        if (isset($expression['parameters'][3]) && 'int' === $expression['parameters'][3]['parameter']['type']) {
            $flags = $expression['parameters'][3]['parameter']['value'].' ';
            $offsetParamOffset = 3;
            unset($expression['parameters'][3]);
        }

        try {
            $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);

            if (null === $offset && isset($resolvedParams[$offsetParamOffset])) {
                $context->headersManager->add('kernel/operators');
                $offset = 'zephir_get_intval('.$resolvedParams[$offsetParamOffset].') ';
            }

            if (null === $flags && isset($resolvedParams[3])) {
                $context->headersManager->add('kernel/operators');
                $flags = 'zephir_get_intval('.$resolvedParams[3].') ';
            }
        } catch (Exception $e) {
            throw new CompilerException($e->getMessage(), $expression, $e->getCode(), $e);
        }

        if (null === $flags) {
            $flags = '0 ';
        }

        if (null === $offset) {
            $offset = '0 ';
        }

        return [$flags, $offset];
    }
1054728
private function _runProducer($call, $params, $before, $after, string $type)
    {
        /** @var $obj */
        $controller = Core::getInstance()->getContainer()->build($call[0]);
        $producer = Producer::getProducer($type);
        $this->_addAction($producer, $before, 'Before');
        $this->_addAction($producer, $after, 'After');
        $producer->addProducer($controller, $call[1], $params);
        return $producer->run();
    }
360876
public static function getAfterActions($clazz, $action) {
        if (static::$afterActions[ $clazz ]) {
            return static::buildActions(static::$afterActions[ $clazz ], $action);
        }
        return null;
    }
950886
public function call($fx, $args = null)
    {
        $this->mode = 'call';
        $this->args['fx'] = $fx;
        if (!is_null($args)) {
            $this->args($args);
        }
        $this->template = 'call [fx]([args])';

        return $this;
    }
1195570
public static function before($clazz, $actions, $beforeClazz, $warpAction, $call = null) {
        $actions = static::actionsBuild($actions);
        if (!isset(static::$beforeActions[ $clazz ])) {
            static::$beforeActions[ $clazz ] = array();
        }
        if (!isset(static::$beforeActions[ $clazz ][ $actions[ 'type' ] ])) {
            static::$beforeActions[ $clazz ][ $actions[ 'type' ] ] = array();
        }
        $info = array('methods' => $actions[ 'methods' ],
                      'class' => $beforeClazz,
                      'action' => $warpAction,
                      "call" => $call,
                      "range" => static::$range);
        static::$range++;
        static::$beforeActions[ $clazz ][ $actions[ 'type' ] ][] = $info;
    }
1345466
public function __soapCall($methodName, $arguments, $options = null, $inputHeaders = null, &$outputHeaders = null)
    {
        if ($this->isFinancialMethod($methodName, $arguments)) {
            $usedMethod = $methodName;

            if ($methodName === 'AccountManagement') {
                $usedMethod .= $arguments[0]->getAction();
            }

            $operationNum = time();
            $financeToken = $this->user->createFinanceToken($usedMethod, $operationNum);

            if (!is_array($inputHeaders)) {
                $inputHeaders = [];
            }

            $inputHeaders[] = new \SoapHeader('API', 'finance_token', $financeToken);
            $inputHeaders[] = new \SoapHeader('API', 'operation_num', $operationNum);
        }

        return parent::__soapCall($methodName, $arguments, $options, $inputHeaders, $outputHeaders);
    }
1008838
private function validateCall(\stdClass $call)
    {
        $result = null;
        $error = null;
        $data = null;
        $id = is_object($call) && property_exists($call, 'id') ? $call->id : null;
        do {
            if (!is_object($call)) {
                $error = self::INVALIDREQUEST;
                break;
            }

            // hack for inputEx smd tester
            if (property_exists($call, 'version')) {
                if ($call->version == 'json-rpc-2.0') {
                    $call->jsonrpc = '2.0';
                }
            }

            if (!property_exists($call, 'jsonrpc') || $call->jsonrpc != '2.0') {
                $error = self::INVALIDREQUEST;
                break;
            }

            $fullMethod = property_exists($call, 'method') ? $call->method : '';
            $methodInfo = explode('.', $fullMethod, 2);
            $namespace = array_key_exists(1, $methodInfo) ? $methodInfo[0] : '';
            $method = $namespace ? $methodInfo[1] : $fullMethod;
            if (!$method || !array_key_exists($namespace, $this->instances) ||
                !method_exists($this->instances[$namespace], $method) ||
                in_array(strtolower($method), $this->hiddenMethods)) {
                $error = self::METHODNOTFOUND;
                break;
            }

            if (!array_key_exists($fullMethod, $this->reflectionMethods)) {
                $this->reflectionMethods[$fullMethod] = new \ReflectionMethod($this->instances[$namespace], $method);
            }

            /** @var $params array */
            $params = property_exists($call, 'params') ? $call->params : null;
            $paramsType = gettype($params);
            if ($params !== null && $paramsType != 'array' && $paramsType != 'object') {
                $error = self::INVALIDPARAMS;
                $data = 'Cast of params error';
                break;
            }

            // check parameters
            switch ($paramsType) {
                case 'array':
                    $totalRequired = 0;
                    // doesn't hold required, null, required sequence of params
                    foreach ($this->reflectionMethods[$fullMethod]->getParameters() as $param) {
                        if (!$param->isDefaultValueAvailable()) {
                            $totalRequired++;
                        }
                    }

                    if (count($params) < $totalRequired) {
                        $error = self::INVALIDPARAMS;
                        $data = sprintf(
                            'Check numbers of required params (got %d, expected %d)',
                            count($params),
                            $totalRequired
                        );
                    }
                    break;
                case 'object':
                    foreach ($this->reflectionMethods[$fullMethod]->getParameters() as $param) {
                        if (!$param->isDefaultValueAvailable() && !array_key_exists($param->getName(), $params)) {
                            $error = self::INVALIDPARAMS;
                            $data = $param->getName() . ' not found';

                            break 3;
                        }
                    }
                    break;
                case 'NULL':
                    if ($this->reflectionMethods[$fullMethod]->getNumberOfRequiredParameters() > 0) {
                        $error = self::INVALIDPARAMS;
                        $data = 'Empty required params';
                        break 2;
                    }
                    break;
            }
        } while (false);

        if ($error) {
            $result = [$error, $id, $data];
        }

        return $result;
    }
627691
public void addActionImport(Class<?> cls) {
        EdmActionImport actionImportAnnotation = cls.getAnnotation(EdmActionImport.class);
        ActionImportImpl.Builder actionImportBuilder = new ActionImportImpl.Builder()
                .setEntitySetName(actionImportAnnotation.entitySet())
                .setActionName(actionImportAnnotation.namespace() + "." + actionImportAnnotation.action())
                .setName(actionImportAnnotation.name())
                .setJavaClass(cls);

        actionImportBuilders.add(actionImportBuilder);
    }