Background
- The current implementation of the Linker obtains a LinkRenderer from a number of places, and the logic that does so is verbose:
- It requires to obtain a reference to the service container first (sometimes stored into a local variable to make the code more readable)
- Sometimes that requires using a different way of obtaining the service depending on the link options (i.e. get the renderer by directly calling the service container versus obtaining a factory that in turn obtains the renderer itself).
- This verbosity makes it harder to follow the core logic of the link() method itself.
- During the review of https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1224698, refactoring the Linker to have the conditional logic to get a LinkRenderer instance was regarded as outside of the scope of the associated ticket.
Acceptance Criteria
- The logic to obtain the LinkRenderer is moved into a common method