-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make addLink accessor public #90
Conversation
Hi @jkrzefski , Could you please precise me what kind of customizations you would like to achieve? The If you really want to add unsupported link relations to let's say resources, then you can do the following:
I don't know if this workflow suits your needs, but generally, this should be the way to go. |
Yes, that was exactly my case. I wanted to extend the But still, having this accessor public does not mean, your library is incompatible with the specification. It only makes it a more versatile utility for people who (for whatever reason) have to use custom links. So I can still see this being useful somehow. Or maybe you know a better (more compliant) way to add custom links to a resource. In my case the resource was a file and I added a link |
OK, I understand your point, it makes sense to make adding custom links easier. However, the So instead of making /**
* @param Link[] $links
*/
public function setLinks(array $links): DocumentLinks
{
foreach ($links as $rel => $link) {
$this->addLink($rel, $link);
}
return $this;
}
public function setLink(string $name, ?Link $link): DocumentLinks
{
$this->addLink($name, $link);
return $this;
} Of course, the return type declarations should be removed, and replaced with a |
I undid my accessor change and added your suggested change instead. I did one thing slightly different though: I used the return type |
@jkrzefski Thanks for the change! I think the |
Done. |
Perfect, thanks for your work! I'll create a release with this change in the coming days (possibly today or tomorrow). |
When customizing the links of a document it is rather challenging to have the
addLink
method not publicly available. This PR fixes that.