Neomerx\JsonApi\Document\Presenters\ElementPresenter::getRelationRepresentation PHP Метод

getRelationRepresentation() приватный Метод

private getRelationRepresentation ( Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $parent, Neomerx\JsonApi\Contracts\Schema\RelationshipObjectInterface $relation ) : array
$parent Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface
$relation Neomerx\JsonApi\Contracts\Schema\RelationshipObjectInterface
Результат array
    private function getRelationRepresentation(ResourceObjectInterface $parent, RelationshipObjectInterface $relation)
    {
        $isOk = $relation->getName() !== Document::KEYWORD_SELF;
        if ($isOk === false) {
            throw new InvalidArgumentException(T::t('\'%s\' is a reserved keyword and cannot be used as a relationship name in type \'%s\'', [Document::KEYWORD_SELF, $parent->getType()]));
        }
        $representation = [];
        if (($meta = $relation->getMeta()) !== null) {
            $representation[Document::KEYWORD_META] = $meta;
        }
        $baseUrl = $this->document->getUrlPrefix();
        foreach ($relation->getLinks() as $name => $link) {
            $representation[Document::KEYWORD_LINKS][$name] = $this->getLinkRepresentation($baseUrl, $link);
        }
        return $representation;
    }