protected function extractReturn($model, $comments = '')
    {
        $modelDto = [];
        preg_match('/\@return\ (.*)\((.*)\)\n/i', $comments, $returnTypes);
        if (count($returnTypes)) {
            // Extract principal DTO information
            if (array_key_exists(1, $returnTypes)) {
                $modelDto = $this->extractDtoProperties($returnTypes[1]);
            }
            if (array_key_exists(2, $returnTypes)) {
                $subDtos = preg_split('/,?\ /', str_replace('{__API__}', $model, $returnTypes[2]));
                if (count($subDtos)) {
                    foreach ($subDtos as $subDto) {
                        list($field, $dtoName) = explode('=', $subDto);
                        $isArray = false;
                        if (false !== strpos($dtoName, '[') && false !== strpos($dtoName, ']')) {
                            $dtoName = str_replace(']', '', str_replace('[', '', $dtoName));
                            $isArray = true;
                        }
                        $dto = $this->extractModelFields($dtoName);
                        $modelDto[$field] = $isArray ? [$dto] : $dto;
                        $modelDto['objects'][$dtoName] = $dto;
                        $modelDto = $this->checkDtoAttributes($dto, $modelDto, $dtoName);
                    }
                }
            }
        }

        return $modelDto;
    }
protected function extractReturn($model, $comments = '')
    {
        $modelDto = [];
        preg_match('/\@return\ (.*)\((.*)\)\n/i', $comments, $returnTypes);
        if (count($returnTypes)) {
            // Extract principal DTO information
            if (array_key_exists(1, $returnTypes)) {
                $modelDto = $this->extractDtoProperties($returnTypes[1]);
            }
            if (array_key_exists(2, $returnTypes)) {
                $subDtos = preg_split('/,?\ /', str_replace('{__API__}', $model, $returnTypes[2]));
                if (count($subDtos)) {
                    foreach ($subDtos as $subDto) {
                        list($field, $dtoName) = explode('=', $subDto);
                        $isArray = false;
                        if (false !== strpos($dtoName, '[') && false !== strpos($dtoName, ']')) {
                            $dtoName = str_replace(']', '', str_replace('[', '', $dtoName));
                            $isArray = true;
                        }
                        $dto = $this->extractModelFields($dtoName);
                        $modelDto[$field] = $isArray ? [$dto] : $dto;
                        $modelDto['objects'][$dtoName] = $dto;
                        $modelDto = $this->checkDtoAttributes($dto, $modelDto, $dtoName);
                    }
                }
            }
        }

        return $modelDto;
    }
protected function extractReturn ( $ model , $ comments = '' ) { $ modelDto = [ ] ; preg_match ( '/\@return\ (.*)\((.*)\)\n/i' , $ comments , $ returnTypes ) ; if ( count ( $ returnTypes ) ) { // Extract principal DTO information if ( array_key_exists ( 1 , $ returnTypes ) ) { $ modelDto = $ this -> extractDtoProperties ( $ returnTypes [ 1 ] ) ; } if ( array_key_exists ( 2 , $ returnTypes ) ) { $ subDtos = preg_split ( '/,?\ /' , str_replace ( '{__API__}' , $ model , $ returnTypes [ 2 ] ) ) ; if ( count ( $ subDtos ) ) { foreach ( $ subDtos as $ subDto ) { list ( $ field , $ dtoName ) = explode ( '=' , $ subDto ) ; $ isArray = false ; if ( false !== strpos ( $ dtoName , '[' ) && false !== strpos ( $ dtoName , ']' ) ) { $ dtoName = str_replace ( ']' , '' , str_replace ( '[' , '' , $ dtoName ) ) ; $ isArray = true ; } $ dto = $ this -> extractModelFields ( $ dtoName ) ; $ modelDto [ $ field ] = $ isArray ? [ $ dto ] : $ dto ; $ modelDto [ 'objects' ] [ $ dtoName ] = $ dto ; $ modelDto = $ this -> checkDtoAttributes ( $ dto , $ modelDto , $ dtoName ) ; } } } } return $ modelDto ; }
Extract return class for api endpoint

@param string $model
@param string $comments

@return array
Extract return class for api endpoint