/** * Extracts the entity relationship properties from an array of path parts. * * @param array $parts * @return self */ private function extractRelationship(array $parts) { if (isset($parts[2])) { if ('relationships' === $parts[2]) { if (!isset($parts[3])) { throw RestException::invalidRelationshipEndpoint($this->parsedUri['path']); } $this->relationship = ['type' => 'self', 'field' => $parts[3]]; } else { $this->relationship = ['type' => 'related', 'field' => $parts[2]]; } } return $this; }