Create link.
public createLink ( string $subHref, array | object | null $meta = null, boolean $treatAsHref = false ) : Neomerx\JsonApi\Contracts\Document\LinkInterface | ||
$subHref | string | |
$meta | array | object | null | |
$treatAsHref | boolean | If $subHref is a full URL and must not be concatenated with other URLs. |
return | Neomerx\JsonApi\Contracts\Document\LinkInterface |
/** * @param string $relationshipName * @param array $description * @param bool $isShowSelf * @param bool $isShowRelated * * @return array <string,LinkInterface> */ protected function readLinks($relationshipName, array $description, $isShowSelf, $isShowRelated) { $links = $this->getValue($description, self::LINKS, []); if ($isShowSelf === true && isset($links[LinkInterface::SELF]) === false) { $links[LinkInterface::SELF] = $this->factory->createLink(DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $relationshipName); } if ($isShowRelated === true && isset($links[LinkInterface::RELATED]) === false) { $links[LinkInterface::RELATED] = $this->factory->createLink($relationshipName); } return $links; }
/** * @param string $subHref * @param null|mixed $meta * @param bool $treatAsHref * * @return LinkInterface */ protected function createLink($subHref, $meta = null, $treatAsHref = false) { return $this->factory->createLink($subHref, $meta, $treatAsHref); }