Skip to content

Commit 14b4a81

Browse files
committed
Support a non-absolute hook link
Not necessary but this satisfies the method signature
1 parent 2a445a6 commit 14b4a81

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/Model/Integration.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@ public function getLink($rel, $absolute = true)
5252
if (!isset($this->data['_links'][$rel]['href'])) {
5353
throw new \InvalidArgumentException("Link not found: $rel");
5454
}
55-
if (!isset($this->data['_links']['self']['href'])) {
56-
throw new \RuntimeException('Failed to find integration "self" link');
55+
$relativeUrl = $this->data['_links'][$rel]['href'];
56+
if ($absolute) {
57+
if (!isset($this->data['_links']['self']['href'])) {
58+
throw new \RuntimeException('Failed to find integration base URL ("self" link)');
59+
}
60+
$base = $this->data['_links']['self']['href'];
61+
return $this->makeAbsoluteUrl($relativeUrl, $base);
5762
}
58-
return $this->makeAbsoluteUrl($this->data['_links'][$rel]['href'], $this->data['_links']['self']['href']);
63+
return $relativeUrl;
5964
}
6065
return parent::getLink($rel, $absolute);
6166
}

0 commit comments

Comments
 (0)