For a library file, I'm not a fan of defaulting the $urlSegments array to com_content; it should preferably be agnostic.  A part of me would even go to the extent of using a `key => value` set for each required item and throw an exception if all of those segment portions aren't present.