Art4\JsonApiClient\Link::parse PHP Method

parse() public method

Parses the data for this element
public parse ( mixed $object ) : self
$object mixed The data
return self
    public function parse($object)
    {
        if (!is_object($object)) {
            throw new ValidationException('Link has to be an object or string, "' . gettype($object) . '" given.');
        }
        if (!array_key_exists('href', $object)) {
            throw new ValidationException('Link must have a "href" attribute.');
        }
        foreach (get_object_vars($object) as $name => $value) {
            $this->set($name, $value);
        }
        return $this;
    }