@param MethodDoc $method

@return array
972817
public function normalize(MethodDoc $method) : array
    {
        if (null !== $method->getResultDoc()) {
            return [
                '$ref' => $this->definitionRefResolver->getDefinitionRef(
                    $this->definitionRefResolver->getMethodDefinitionId(
                        $method,
                        DefinitionRefResolver::METHOD_RESULT_DEFINITION_TYPE
                    )
                )
            ];
        }

        return ['description' => 'Method result'];
    }
155695
protected function parseMethodDoc($method)
    {
        // Reflect the method
        $reflectionMethod = new \ReflectionMethod($this, $method);
        // Get method documentation
        $doc = $reflectionMethod->getDocComment();

        // Prepare output
        $output = [];

        $longKey = null;

        // Loop through all lines
        foreach (preg_split("/((\r?\n)|(\r\n?))/", $doc) as $line) {

            // Reset value
            $value = '';
            // Reset key
            $key = '';

            // Remove some unwanted chars from the line
            $line = trim(str_replace('*', '', trim($line)));

            // check if line starts with @api
            if (substr($line, 0, 4) == '@api') {
                // find the annotation and use it as a key/identifier, example: @apiDescription
                preg_match('/^@api[a-zA-Z]*/i', $line, $matches);
                $longKey = $matches[0];

                // remove @api from the key/identifier
                $key = lcfirst(str_replace('@api', '', $longKey));

                // remove whitespace from the line
                $value = trim($line);

                // check if line doesn't have a annotation
            } elseif (!in_array(substr($line, 0, 1), ['@', '/']) && !empty($line)) {
                // check if we have the key/identifier from last loop
                if (!empty($longKey)) {
                    // remove whitespace
                    $value .= trim($line);
                    // create key/identifier by removing @api and making first letter lowercase
                    $key = lcfirst(str_replace('@api', '', $longKey));
                }
            } else {
                // don't include this line in the doc
                $longKey = null;
                continue;
            }

            $output = $this->prepareOutput($output, $key, $value, $longKey);
        }

        return $output;
    }
1064466
protected function getApiUrl($method) {
    static $READ_ONLY_CALLS =
      array('admin.getallocation' => 1,
            'admin.getappproperties' => 1,
            'admin.getbannedusers' => 1,
            'admin.getlivestreamvialink' => 1,
            'admin.getmetrics' => 1,
            'admin.getrestrictioninfo' => 1,
            'application.getpublicinfo' => 1,
            'auth.getapppublickey' => 1,
            'auth.getsession' => 1,
            'auth.getsignedpublicsessiondata' => 1,
            'comments.get' => 1,
            'connect.getunconnectedfriendscount' => 1,
            'dashboard.getactivity' => 1,
            'dashboard.getcount' => 1,
            'dashboard.getglobalnews' => 1,
            'dashboard.getnews' => 1,
            'dashboard.multigetcount' => 1,
            'dashboard.multigetnews' => 1,
            'data.getcookies' => 1,
            'events.get' => 1,
            'events.getmembers' => 1,
            'fbml.getcustomtags' => 1,
            'feed.getappfriendstories' => 1,
            'feed.getregisteredtemplatebundlebyid' => 1,
            'feed.getregisteredtemplatebundles' => 1,
            'fql.multiquery' => 1,
            'fql.query' => 1,
            'friends.arefriends' => 1,
            'friends.get' => 1,
            'friends.getappusers' => 1,
            'friends.getlists' => 1,
            'friends.getmutualfriends' => 1,
            'gifts.get' => 1,
            'groups.get' => 1,
            'groups.getmembers' => 1,
            'intl.gettranslations' => 1,
            'links.get' => 1,
            'notes.get' => 1,
            'notifications.get' => 1,
            'pages.getinfo' => 1,
            'pages.isadmin' => 1,
            'pages.isappadded' => 1,
            'pages.isfan' => 1,
            'permissions.checkavailableapiaccess' => 1,
            'permissions.checkgrantedapiaccess' => 1,
            'photos.get' => 1,
            'photos.getalbums' => 1,
            'photos.gettags' => 1,
            'profile.getinfo' => 1,
            'profile.getinfooptions' => 1,
            'stream.get' => 1,
            'stream.getcomments' => 1,
            'stream.getfilters' => 1,
            'users.getinfo' => 1,
            'users.getloggedinuser' => 1,
            'users.getstandardinfo' => 1,
            'users.hasapppermission' => 1,
            'users.isappuser' => 1,
            'users.isverified' => 1,
            'video.getuploadlimits' => 1);
    $name = 'api';
    if (isset($READ_ONLY_CALLS[strtolower($method)])) {
      $name = 'api_read';
    } else if (strtolower($method) == 'video.upload') {
      $name = 'api_video';
    }
    return self::getUrl($name, 'restserver.php');
  }
1268412
public function normalize(MethodDoc $method) : array
    {
        $requestSchema = ['allOf' => [$this->shapeNormalizer->getRequestShapeDefinition()]];
        // Append custom if params required
        if (null !== $method->getParamsDoc()) {
            $methodParamsDefinitionRef = $this->definitionRefResolver->getDefinitionRef(
                $this->definitionRefResolver->getMethodDefinitionId(
                    $method,
                    DefinitionRefResolver::METHOD_PARAMS_DEFINITION_TYPE
                )
            );

            $requestSchema['allOf'][] = [
                'type' => 'object',
                'required' => ['params'],
                'properties' => [
                    'params' => ['$ref' => $methodParamsDefinitionRef],
                ],
            ];
        }
        $requestSchema['allOf'][] = [
            'type' => 'object',
            'properties' => [
                'method' => ['example' => $method->getMethodName()],
            ],
        ];

        return $requestSchema;
    }
442477
protected function getMethodErrorsExternalSchemaList(ServerDoc $doc) : array
    {
        $list = [];
        foreach ($doc->getMethodList() as $method) {
            foreach ($method->getCustomErrorList() as $errorDoc) {
                $key = $this->definitionRefResolver->getErrorDefinitionId(
                    $errorDoc,
                    DefinitionRefResolver::CUSTOM_ERROR_DEFINITION_TYPE
                );
                $list[$key] = $this->errorDocNormalizer->normalize($errorDoc);
            }
        }

        return $list;
    }
1101460
protected function getMethodErrorsExternalSchemaList(ServerDoc $doc) : array
    {
        $list = [];
        foreach ($doc->getMethodList() as $method) {
            $list = array_merge(
                $list,
                $this->normalizeErrorList(
                    $method->getCustomErrorList(),
                    DefinitionRefResolver::CUSTOM_ERROR_DEFINITION_TYPE
                )
            );
        }

        return $list;
    }
1149509
private function getOperationHydraDoc(string $method, array $hydraDoc): array
    {
        if (!isset($hydraDoc['hydra:supportedOperation']) || !\is_array($hydraDoc['hydra:supportedOperation'])) {
            return [];
        }

        foreach ($hydraDoc['hydra:supportedOperation'] as $supportedOperation) {
            if ($supportedOperation['hydra:method'] === $method) {
                return $supportedOperation;
            }
        }

        return [];
    }
1346832
private function getProxyMethods(): array
    {
        if (null !== $this->reflectionProxyMethods) {
            return $this->reflectionProxyMethods;
        }

        $proxyMethods = [];
        $methods = $this->getClassMethods();

        foreach ($methods as $method) {
            $docComment = $method->getDocComment();

            if (\strpos($docComment, 'Transactional') !== false) {
                $annotation = $this->annotationReader->getMethodAnnotation(
                    $method,
                    Transactional::class
                );

                if ($annotation) {
                    $proxyMethods[] = $method;
                }
            }
        }

        $this->reflectionProxyMethods = $proxyMethods;

        return $proxyMethods;
    }
584862
private function getOptions(MethodInterface $method)
    {
        if ($method->getMethod() == $method::GET) {
            return [
                'query' => $method->getAttributes(),
            ];
        }

        return [
            'headers' => [
                'Content-Type' => 'application/json',
            ],
            'body' => json_encode(
                $this->prepareAttributes($method->getAttributes()),
                JSON_FORCE_OBJECT
            )
        ];
    }
141843
private function getMethodParameters(string $class, string $methodName) : array
    {
        $methodReflection = new ReflectionMethod($class, $methodName);
        $parametersName   = [];

        foreach ($methodReflection->getParameters() as $parameter) {
            $parametersName[] = $parameter->name;
        }

        return $parametersName;
    }
1174676
protected function getMethodParameters($method, $docBlock = null): array
    {
        $result = [];

        /** @var \ReflectionParameter $param */
        foreach ($method->getParameters() as $param) {
            $parameter = new SmdParameter();
            $parameter->name = $param->getName();
            if (PHP_VERSION_ID > 70000) {
                $parameter->types = [(string)$param->getType()];
            }
            $parameter->optional = $param->isOptional();
            if ($parameter->optional) {
                $parameter->default = $param->getDefaultValue();
            }

            $result[$param->getName()] = $parameter;
        }

        if ($docBlock === null) {
            return array_values($result);
        }

        $params = $docBlock->getTagsByName(self::API_METHOD_DEFAULT_PARAMS);

        /** @var DocBlock\Tags\Param $param */
        foreach ($params as $param) {
            $name = (string)$param->getVariableName();

            $parameter = $result[$name] ?? new SmdParameter();
            $parameter->name = $name;

            if (!empty((string)$param->getDescription())) {
                $parameter->description = (string)$param->getDescription();
            }
            if (!empty((string)$param->getType())) {
                $parameter->types = explode('|', (string)$param->getType());
            }

            $result[$name] = $parameter;
        }

        /** @var ApiParam[] $params */
        $params = $docBlock->getTagsByName(self::API_METHOD_PARAMS);

        foreach ($params as $param) {
            $result = $this->getExtendedParameters($param, $result);
        }

        return array_values($result);
    }
1300925
private static function getMethods($methods, $class): array
    {
        $methods[] = \array_fill_keys(\get_class_methods($class), 0);
        $parent = \get_parent_class($class);
        if ($parent) {
            \array_merge($methods, self::getMethods($methods, $parent));
        }
        return $methods[0];
    }
1102049
protected function getMethodPartAndVerb($method)
    {
        preg_match($this->methodRule, $method, $matches);

        return empty($matches) ? false : array_slice($matches, 1);
    }
43810
public function parameterize($method)
    {
        $parameterArray = array();
        switch ($method) {
            case 'create':
            case 'update':
                $parameterArray['email'] = $this->getEmail();
                $parameterArray['description'] = $this->getDescription();
                break;
            case 'getOne':
                $parameterArray['count'] = 1;
                $parameterArray['offset'] = 0;
                break;
            case 'getAll':
                $parameterArray = $this->getFilter();
                break;
            case 'delete':
                break;
        }

        return $parameterArray;
    }
1155811
public static function fromMethodName(string $methodName): array
    {
        if (strpos($methodName, '::') > 0) {
            list($className, $functionName) = explode('::', $methodName);
        } elseif (substr($methodName, -9, 9) === '{closure}') {
            $className = substr($methodName, 0, -9);
            $functionName = '{closure}';
        }

        return [
            'FLOW_LOG_ENVIRONMENT' => [
                'packageKey' => self::getPackageKeyFromClassName($className),
                'className' => $className,
                'methodName' => $functionName
            ]
        ];
    }
95099
public function checkMethods(array $methods): array
    {
        return array_map(
            function($method) {
                $method = strtolower($method);
                if (!\in_array($method, self::METHODS, false)) {
                    throw new Exception("Method \"$method\" is not in allowed list [" . implode(',',
                            self::METHODS) . ']');
                }
                return $method;
            },
            $methods
        );
    }
446296
public final function getMethodArguments(string $method = null): ?array
    {
        return $method ? $this->methodArguments[$method] ?? null : $this->methodArguments;
    }