Improve '_get_contents_info' function to reduce Cyclomatic Complexity