Art4\JsonApiClient\Relationship::parseData PHP Method

parseData() protected method

Parse the data value
protected parseData ( null | array | object $data ) : null | ResourceIdentifier | ResourceIdentifierCollection
$data null | array | object Data value
return null | ResourceIdentifier | ResourceIdentifierCollection The parsed data
    protected function parseData($data)
    {
        if ($data === null) {
            return $data;
        }
        if (is_array($data)) {
            $collection = $this->manager->getFactory()->make('ResourceIdentifierCollection', [$this->manager, $this]);
            $collection->parse($data);
            return $collection;
        }
        $identifier = $this->manager->getFactory()->make('ResourceIdentifier', [$this->manager, $this]);
        $identifier->parse($data);
        return $identifier;
    }