@param TypeDoc $docObject

@return array

@throws \ReflectionException
14435
protected function appendMisc(TypeDoc $docObject) : array
    {
        $docArray = [];
        $docArray = $this->appendIfNotNull($docArray, 'default', $docObject->getDefault());
        $docArray = $this->appendIfNotNull($docArray, 'example', $docObject->getExample());

        if ($docObject instanceof StringDoc) {
            $docArray = $this->appendIfNotNull($docArray, 'format', $docObject->getFormat());
        } elseif ($docObject instanceof ArrayDoc && null !== $docObject->getItemValidation()) {
            $docArray['item_validation'] = $this->normalize($docObject->getItemValidation());
        }

        return $docArray;
    }
607479
protected function docToArray(RpbSearchDoc $doc)
    {
        if ( ! $doc->hasFields()) {
            return [];
        }

        $values = [];

        foreach ($doc->fields as $pair) {
            $values[$pair->key][] = $pair->value;
        }

        return $values;
    }
1035370
private function getTypeFromDocBock(ReflectionMethod $method, DocBlockReader $docBlock): ?Type
    {
        $typeDeclaration = $docBlock->getReturnType();
        $blacklist = [
            'Collection',
            'array',
        ];

        if ($typeDeclaration && !in_array($typeDeclaration, $blacklist, true)) {
            return $this->getTypeFromPhpDeclaration($method, $typeDeclaration);
        }

        return null;
    }
231080
public function normalize(ServerDoc $doc) : array
    {
        return array_merge(
            $this->getMethodsExternalSchemaList($doc),
            $this->getMethodErrorsExternalSchemaList($doc),
            $this->getServerErrorsExtraSchemaList($doc)
        );
    }
432685
public function normalize(TypeDoc $doc) : array
    {
        $siblingsDoc = $paramDocRequired = [];

        $siblingsDoc = $this->appendArrayDoc($doc, $siblingsDoc);
        list (
            $siblingsDoc,
            $paramDocRequired
            ) = $this->appendObjectDoc($doc, $siblingsDoc, $paramDocRequired);

        $format = ($doc instanceof StringDoc ? $doc->getFormat() : null);

        return $this->appendIfValueNotNull('description', $doc->getDescription())
            + ['type' => $this->schemaTypeNormalizer->normalize($doc)]
            + $this->appendIfValueNotNull('format', $format)
            + ['nullable' => $doc->isNullable()]
            + $paramDocRequired
            + $this->appendIfValueNotNull('default', $doc->getDefault())
            + $this->appendIfValueNotNull('example', $doc->getExample())
            + $this->appendIfValueHaveSiblings('enum', array_values($doc->getAllowedValueList()))
            + $this->getMinMaxDoc($doc)
            + $siblingsDoc
        ;
    }
529019
public function getMetaObject(string $obj): self
    {
        static $STATIC_CACHE = [];

        $cacheKey = $obj;
        if (!empty($STATIC_CACHE[$cacheKey])) {
            return $STATIC_CACHE[$cacheKey];
        }

        $reflector = new \ReflectionClass($obj);
        $factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
        $docComment = $reflector->getDocComment();
        if ($docComment) {
            $docblock = $factory->create($docComment);
            foreach ($docblock->getTagsByName('property') as $tag) {
                /** @var \phpDocumentor\Reflection\DocBlock\Tags\Property $tag */
                $PropertyName = $tag->getVariableName();
                $this->{$PropertyName} = $PropertyName;
            }
        }

        $STATIC_CACHE[$cacheKey] = $this;

        return $this;
    }
1185101
public static function getClassAnnotations($object)
	{
		$classReflection = new \ReflectionClass($object);
		$docBlock = $classReflection->getDocComment();
		$lines = explode("\n", $docBlock);
		$annotations = array();
		foreach ($lines as $line)
		{
			if (preg_match('~^(((\s*\*)|/\*\*)\s*@)(?<annotationName>[^\s]+)\s+(?<annotationValue>.*)~', $line, $matches))
			{
				$annotations[$matches['annotationName']][] = $matches['annotationValue'];
			}
		}
		return $annotations;
	}
1210253
public function getObjectPropertyAnnotations($document)
    {
        $cacheKey = "object_property_annotations_" . get_class($document);
        if (!$this->cache->contains($cacheKey)) {
            $refObject   = new \ReflectionObject($document);
            $annotations = array();
            foreach ($refObject->getProperties() as $property) {
                $annotation = $this->getPropertyAnnotation($property);
                if ($annotation) {
                    $annotations[$property->getName()] = $annotation;
                }
            }
            $this->cache->save($cacheKey, $annotations);
        }
        return $this->cache->fetch($cacheKey);
    }
262375
public function normalize(MethodDoc $method) : array
    {
        $docTags = [];

        if (count($method->getTagList())) {
            $docTags['tags'] = $method->getTagList();
        }

        return [
                'summary' => sprintf('"%s" json-rpc method', $method->getMethodName()),
            ]
            + $this->getDescriptionDoc($method)
            + $docTags
            + [
                'operationId' => $method->getIdentifier(),
                'consumes' => ['application/json'],
                'produces' => ['application/json'],
                'parameters' => [
                    [
                        'in' => 'body',
                        'name' => 'JsonRpc request',
                        'required' => true,
                        'schema' => $this->requestDocTransformer->normalize($method)
                    ]
                ],
                'responses' => [
                    '200' => [
                        'description' => 'JSON-RPC response',
                        'schema' => $this->responseDocNormalizer->normalize($method),
                    ]
                ]
            ]
        ;
    }
341860
protected function getReturnTypeFromDocBlock(\ReflectionMethod $reflection)
    {
        $type = null;
        $phpdoc = new DocBlock($reflection);

        if ($phpdoc->hasTag('return')) {
            $type = $phpdoc->getTagsByName('return')[0]->getType();
        }

        return $type;
    }
37640
private function __getMethods($object)
    {
        $reflection = new ReflectionClass($object);
        
        //get all methods
        $methods = $reflection->getMethods();
        $this->builtInMethods = array();
        
        //get properties for each method
        if(!empty($methods))
        {
            foreach ($methods as $method) {
                if(!empty($method->name))
                {
                    $methodProp = new ReflectionMethod($object, $method->name);
                    
                    //saves all methods names found
                    $this->builtInMethods['all'][] = $method->name;
                    
                    //saves all private methods names found
                    if($methodProp->isPrivate()) 
                    {
                        $this->builtInMethods['private'][] = $method->name;
                    }
                    
                    //saves all private methods names found                 
                    if($methodProp->isPublic()) 
                    {
                        $this->builtInMethods['public'][] = $method->name;
                        
                        // gets info about the method and saves them. These info will be used for the xmlrpc server configuration.
                        // (only for public methods => avoids also all the public methods starting with '__')
                        if(!preg_match('/^__/', $method->name, $matches))
                        {
                            // -method name
                            $this->builtInMethods['functions'][$method->name]['function'] = $reflection->getName().'.'.$method->name;
                            
                            // -method docstring
                            $this->builtInMethods['functions'][$method->name]['docstring'] = $this->__extractDocString($methodProp->getDocComment());
                        }
                    }
                }
            }
        } else {
            return false;
        }
        return true;
    }
61752
protected function getObjectValues(object $object): array
    {
        $class = new ReflectionClass(get_class($object));
        $constructor = $class->getConstructor();
        if ($constructor instanceof ReflectionMethod) {
            foreach ($constructor->getParameters() as $parameter) {
                $name = $parameter->getName();

                $property = $class->getProperty($name);
                $property->setAccessible(true);

                $value = $property->getValue($object);
                if (is_object($value) === true) {
                    $value = $this->getObjectValues($value);
                }

                $data[$name] = $value;
            }
        }

        return $data ?? [];
    }
1308978
private function getRequirements(string $docComment): array
    {
        return array_map(
            function($tag) {
                preg_match('#@require ([^ ]*)#', $tag, $match);

                return $match[1];
            },
            array_filter(
                array_map(
                    'trim',
                    explode(
                        "\n",
                        str_replace(
                            "\r\n",
                            "\n",
                            $docComment
                        )
                    )
                ),
                function($docline) {
                    return 0 === strpos($docline, '* @require');
                }
            )
        );
    }
261707
private function appendErrorsSchema(MethodDoc $docObject) : array
    {
        $docArray = [];
        // Create custom result schema only if provided
        if (count($docObject->getCustomErrorList()) || count($docObject->getGlobalErrorRefList())) {
            $docArray['errors'] = array_merge(
                array_map(
                    [$this->errorDocNormalizer, 'normalize'],
                    $docObject->getCustomErrorList()
                ),
                array_map(
                    function ($errorIdentifier) {
                        return ['$ref' => sprintf('#/errors/%s', $errorIdentifier)];
                    },
                    $docObject->getGlobalErrorRefList()
                )
            );
        }

        return $docArray;
    }
583007
protected function getDocForEnum($docBlock, array $objects = []): array
    {
        if (!isset($objects[$docBlock->getTypeName()])) {
            $object = new SmdEnumObject();
            $object->name = $docBlock->getTypeName();
            $object->type = 'int';
            $objects[$docBlock->getTypeName()] = $object;
        } else {
            $object = $objects[$docBlock->getTypeName()];
        }

        $value = $docBlock->getValue();

        switch (true) {
            case \is_int($value):
                break;
            case \is_float($value):
                if ($object->type !== 'string') {
                    $object->type = 'float';
                }
                break;
            default:
                $object->type = 'string';
        }

        $values = $object->values;

        $values[] = SmdEnumValue::fromArray([
            'value'       => $value,
            'description' => (string)$docBlock->getDescription(),
        ]);

        $object->values = $values;

        return $objects;
    }
1201301
private function recursiveDeserialize($serializedObject)
    {
        if (!is_array($serializedObject)) {
            return $serializedObject;
        } elseif ($this->dataFormatter->isSerializedObject($serializedObject)) {
            return $this->deserializeObject($serializedObject);
        } else {
            $deserializedArray = [];
            foreach ($serializedObject as $key => $value) {
                $deserializedArray[$key] = $this->recursiveDeserialize($value);
            }

            return $deserializedArray;
        }
    }
273582
protected function getExtendedReturns($docBlock, array $current = []): array
    {
        $name = $docBlock->getVariableName();

        $nameParts = explode('.', $name);
        $variableName = array_shift($nameParts);

        /** @var SmdParameter $parameter */
        if (isset($current[$variableName])) {
            $parameter = $current[$variableName];
        } else {
            $parameter = new SmdParameter();
            $parameter->name = $variableName;
            $current[$variableName] = $parameter;
        }

        while ($key = array_shift($nameParts)) {
            $isArray = false;
            $variableName = $key;
            if (substr($variableName, -2) === '[]') {
                $variableName = substr($variableName, 0, -2);
                $isArray = true;
            }

            $parameter->types = ['object'];
            $parameters = $parameter->parameters;

            if (!isset($parameters[$variableName])) {
                $parameters[$variableName] = new SmdParameter();
            }

            $parameter->parameters = $parameters;
            $parameter = $parameters[$variableName];

            if ($isArray) {
                $parameter->array = true;
            }
        }

        $parameter->name = $variableName;

        $parameter = $this->checkParamType($parameter, $docBlock->getType());

        if (!empty((string)$docBlock->getDescription())) {
            $parameter->description = (string)$docBlock->getDescription();
        }

        if ($docBlock->isRoot()) {
            $parameter->is_root = true;
        }

        return $current;
    }