private function createMethodGenerator($methodName, $body, DocBlockGenerator $docBlock, $parameterInfoArray, $returnType = null) {
        $parameters = [];
        foreach ($parameterInfoArray as $parameterInfo) {
            $parameters[] = new ParameterGenerator($parameterInfo[0], $parameterInfo[1]);
        }

        $methodGenerator = new MethodGenerator($methodName);
        $methodGenerator->setParameters($parameters);
        
        if ($returnType != null) {
            if (is_array($returnType)) {
                $returnType = implode('|', $returnType);
            }
            
            $tags[] = new GenericTag('return', $returnType);
            $docBlock->setTags($tags);
        }
        
        $methodGenerator->setDocBlock($docBlock);
        $methodGenerator->setBody($body);
        
        return $methodGenerator;
    }