Art4\JsonApiClient\Link::set PHP Method

set() protected method

Set a link
protected set ( string $name, string | object $link ) : self
$name string The Name
$link string | object The Link
return self
    protected function set($name, $link)
    {
        if ($name === 'meta') {
            $meta = $this->manager->getFactory()->make('Meta', [$this->manager, $this]);
            $meta->parse($link);
            $this->container->set($name, $meta);
            return $this;
        }
        // every link must be an URL
        if (!is_string($link)) {
            throw new ValidationException('Every link attribute has to be a string, "' . gettype($link) . '" given.');
        }
        $this->container->set($name, strval($link));
        return $this;
    }