public function buildOutput(ApiDoc $annotation, $data = null)
    {
        $annotationReflection = new \ReflectionClass('Nelmio\ApiDocBundle\Annotation\ApiDoc');
        $outputReflection = $annotationReflection->getProperty('output');
        $outputReflection->setAccessible(true);
        if (!(isset($data['output']) || $data['output'] === null) || empty($data['output'])) {
            if ($annotation->toArray()['method'] === 'POST' || $annotation->toArray()['method'] === 'PUT') {
                $actionName = $annotation->getRoute()->getDefault('_controller');
                $reflectionMethod = new \ReflectionMethod($actionName);
                $phpdoc = $reflectionMethod->getDocComment();
                $return = substr($phpdoc, strpos($phpdoc, '@return'));
                $returnType = str_replace(['@return \\', '*', '[]', 'array<\\', '>'], '', $return);
                $returnType = substr($returnType, 0, strpos($returnType, strstr($returnType, "\n")));
                $returnType = preg_replace("/\r\n|\r|\n|\\/\\s+/", '', $returnType);

                if (class_exists($returnType) || interface_exists($returnType)) {
                    $outputReflection->setValue($annotation, $returnType);
                }
            }
        } else {
            $outputReflection->setValue($annotation, $data['output']);
        }

        return $annotation;
    }
public function buildOutput(ApiDoc $annotation, $data = null)
    {
        $annotationReflection = new \ReflectionClass('Nelmio\ApiDocBundle\Annotation\ApiDoc');
        $outputReflection = $annotationReflection->getProperty('output');
        $outputReflection->setAccessible(true);
        if (!(isset($data['output']) || $data['output'] === null) || empty($data['output'])) {
            if ($annotation->toArray()['method'] === 'POST' || $annotation->toArray()['method'] === 'PUT') {
                $actionName = $annotation->getRoute()->getDefault('_controller');
                $reflectionMethod = new \ReflectionMethod($actionName);
                $phpdoc = $reflectionMethod->getDocComment();
                $return = substr($phpdoc, strpos($phpdoc, '@return'));
                $returnType = str_replace(['@return \\', '*', '[]', 'array<\\', '>'], '', $return);
                $returnType = substr($returnType, 0, strpos($returnType, strstr($returnType, "\n")));
                $returnType = preg_replace("/\r\n|\r|\n|\\/\\s+/", '', $returnType);

                if (class_exists($returnType) || interface_exists($returnType)) {
                    $outputReflection->setValue($annotation, $returnType);
                }
            }
        } else {
            $outputReflection->setValue($annotation, $data['output']);
        }

        return $annotation;
    }
public function buildOutput ( ApiDoc $ annotation , $ data = null ) { $ annotationReflection = new \ ReflectionClass ( 'Nelmio\ApiDocBundle\Annotation\ApiDoc' ) ; $ outputReflection = $ annotationReflection -> getProperty ( 'output' ) ; $ outputReflection -> setAccessible ( true ) ; if ( ! ( isset ( $ data [ 'output' ] ) || $ data [ 'output' ] === null ) || empty ( $ data [ 'output' ] ) ) { if ( $ annotation -> toArray ( ) [ 'method' ] === 'POST' || $ annotation -> toArray ( ) [ 'method' ] === 'PUT' ) { $ actionName = $ annotation -> getRoute ( ) -> getDefault ( '_controller' ) ; $ reflectionMethod = new \ ReflectionMethod ( $ actionName ) ; $ phpdoc = $ reflectionMethod -> getDocComment ( ) ; $ return = substr ( $ phpdoc , strpos ( $ phpdoc , '@return' ) ) ; $ returnType = str_replace ( [ '@return \\' , '*' , '[]' , 'array<\\' , '>' ] , '' , $ return ) ; $ returnType = substr ( $ returnType , 0 , strpos ( $ returnType , strstr ( $ returnType , "\n" ) ) ) ; $ returnType = preg_replace ( "/\r\n|\r|\n|\\/\\s+/" , '' , $ returnType ) ; if ( class_exists ( $ returnType ) || interface_exists ( $ returnType ) ) { $ outputReflection -> setValue ( $ annotation , $ returnType ) ; } } } else { $ outputReflection -> setValue ( $ annotation , $ data [ 'output' ] ) ; } return $ annotation ; }
Method that adds the output property of ApiDoc
getting the model's fully qualified name.

@param ApiDoc     $annotation The annotation
@param array|null $data       The data given

@return ApiDoc
Method that adds the output property of ApiDoc getting the model s fully qualified name .