The PageURLLookup service should provide a new home for the URL related methods in the Title class.
Rough interface draft:
class PageURLLookup { public function getPrefixedURL( $page ); public function getFullURL( $page, $query = '', $query2 = false, $proto = PROTO_RELATIVE )( $page ); public function getFullUrlForRedirect( $page, $query = '', $proto = PROTO_CURRENT ); public function getLocalURL( $page, $query = '', $query2 = false ); public function getLinkURL( $page, $query = '', $query2 = false, $proto = false ); public function getInternalURL( $page, $query = '', $query2 = false ); public function getCanonicalURL( $page, $query = '', $query2 = false ); }
We can make $page be of type PageReference|LinkTarget for convenience.
Alternative Design
We can make a Linkable entity that has all the getter from Title. Title could even implement that interface. And we could have two new implementations, one wrapping a Pagereference, the other wrapping a LinkTarget.
We's then need a factory for such Linkable entities, though.