PHP Class Neomerx\JsonApi\Document\Presenters\ElementPresenter

显示文件 Open project: neomerx/json-api Class Usage Examples

Public Methods

Method Description
__construct ( Document $document )
addRelationshipTo ( array &$target, Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $parent, Neomerx\JsonApi\Contracts\Schema\RelationshipObjectInterface $relation, Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $resource ) : void
convertDataResourceToArray ( Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $resource, boolean $isShowAttributes ) : array Convert resource object for 'data' section to array.
convertIncludedResourceToArray ( Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $resource ) : array Convert resource object for 'included' section to array.
getLinksRepresentation ( string | null $prefix = null, \Neomerx\JsonApi\Contracts\Schema\LinkInterface>\arraynull $links = null ) : array | null | string
setRelationshipTo ( array &$target, Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $parent, Neomerx\JsonApi\Contracts\Schema\RelationshipObjectInterface $relation, mixed $value ) : void

Private Methods

Method Description
convertResourceToArray ( Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $resource, array $resourceLinks, mixed $meta, boolean $isShowAttributes ) : array Convert resource object to array.
getLinkRepresentation ( string | null $prefix = null, Neomerx\JsonApi\Contracts\Document\LinkInterface $link = null ) : array | null | string
getLinkageRepresentation ( Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $resource ) : string>\array
getRelationRepresentation ( Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $parent, Neomerx\JsonApi\Contracts\Schema\RelationshipObjectInterface $relation ) : array
getUrlRepresentation ( string $url, null | object | array $meta = null ) : string | array

Method Details

__construct() public method

public __construct ( Document $document )
$document Neomerx\JsonApi\Document\Document

addRelationshipTo() public method

public addRelationshipTo ( array &$target, Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $parent, Neomerx\JsonApi\Contracts\Schema\RelationshipObjectInterface $relation, Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $resource ) : void
$target array
$parent Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface
$relation Neomerx\JsonApi\Contracts\Schema\RelationshipObjectInterface
$resource Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface
return void

convertDataResourceToArray() public method

Convert resource object for 'data' section to array.
public convertDataResourceToArray ( Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $resource, boolean $isShowAttributes ) : array
$resource Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface
$isShowAttributes boolean
return array

convertIncludedResourceToArray() public method

Convert resource object for 'included' section to array.
public convertIncludedResourceToArray ( Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $resource ) : array
$resource Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface
return array

getLinksRepresentation() public method

public getLinksRepresentation ( string | null $prefix = null, \Neomerx\JsonApi\Contracts\Schema\LinkInterface>\arraynull $links = null ) : array | null | string
$prefix string | null
$links \Neomerx\JsonApi\Contracts\Schema\LinkInterface>\arraynull
return array | null | string

setRelationshipTo() public method

public setRelationshipTo ( array &$target, Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $parent, Neomerx\JsonApi\Contracts\Schema\RelationshipObjectInterface $relation, mixed $value ) : void
$target array
$parent Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface
$relation Neomerx\JsonApi\Contracts\Schema\RelationshipObjectInterface
$value mixed
return void