PHP Интерфейс Neomerx\JsonApi\Contracts\Encoder\EncoderInterface

Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
encodeData ( object | array | Iterato\Iterator | null $data, Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface $parameters = null ) : string Encode input as JSON API string.
encodeError ( Neomerx\JsonApi\Contracts\Document\ErrorInterface $error ) : string Encode error as JSON API string.
encodeErrors ( Neomerx\JsonApi\Contracts\Document\ErrorInterface[] | ErrorCollection $errors ) : string Encode errors as JSON API string.
encodeIdentifiers ( object | array | Iterato\Iterator | null $data, Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface $parameters = null ) : string Encode input as JSON API string with a list of resource identifiers.
encodeMeta ( array | object $meta ) : string Encode input meta as JSON API string.
withJsonApiVersion ( mixed | null $meta = null ) : Neomerx\JsonApi\Contracts\Encoder\EncoderInterface If called JSON API version information with optional meta will be added to a document.
withLinks ( array $links ) : Neomerx\JsonApi\Contracts\Encoder\EncoderInterface Add links that will be encoded with data. Links must be in array format.
withMeta ( mixed | null $meta ) : Neomerx\JsonApi\Contracts\Encoder\EncoderInterface Add meta information that will be encoded with data. If 'null' meta will not appear in a document.
withRelationshipRelatedLink ( object $resource, string $relationshipName, null | mixed $meta = null, boolean $treatAsHref = false ) : Neomerx\JsonApi\Contracts\Encoder\EncoderInterface Add 'related' Link to top-level document's 'links' section for relationship specified.
withRelationshipSelfLink ( object $resource, string $relationshipName, null | mixed $meta = null, boolean $treatAsHref = false ) : Neomerx\JsonApi\Contracts\Encoder\EncoderInterface Add 'self' Link to top-level document's 'links' section for relationship specified.

Описание методов

encodeData() публичный Метод

Encode input as JSON API string.
public encodeData ( object | array | Iterato\Iterator | null $data, Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface $parameters = null ) : string
$data object | array | Iterato\Iterator | null Data to encode.
$parameters Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface Encoding parameters.
Результат string

encodeError() публичный Метод

Encode error as JSON API string.
public encodeError ( Neomerx\JsonApi\Contracts\Document\ErrorInterface $error ) : string
$error Neomerx\JsonApi\Contracts\Document\ErrorInterface
Результат string

encodeErrors() публичный Метод

Encode errors as JSON API string.
public encodeErrors ( Neomerx\JsonApi\Contracts\Document\ErrorInterface[] | ErrorCollection $errors ) : string
$errors Neomerx\JsonApi\Contracts\Document\ErrorInterface[] | Neomerx\JsonApi\Exceptions\ErrorCollection
Результат string

encodeIdentifiers() публичный Метод

Encode input as JSON API string with a list of resource identifiers.
public encodeIdentifiers ( object | array | Iterato\Iterator | null $data, Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface $parameters = null ) : string
$data object | array | Iterato\Iterator | null Data to encode.
$parameters Neomerx\JsonApi\Contracts\Encoder\Parameters\EncodingParametersInterface Encoding parameters.
Результат string

encodeMeta() публичный Метод

Encode input meta as JSON API string.
public encodeMeta ( array | object $meta ) : string
$meta array | object Meta information.
Результат string

withJsonApiVersion() публичный Метод

If called JSON API version information with optional meta will be added to a document.
См. также: http://jsonapi.org/format/#document-jsonapi-object
public withJsonApiVersion ( mixed | null $meta = null ) : Neomerx\JsonApi\Contracts\Encoder\EncoderInterface
$meta mixed | null
Результат Neomerx\JsonApi\Contracts\Encoder\EncoderInterface

withMeta() публичный Метод

Add meta information that will be encoded with data. If 'null' meta will not appear in a document.
public withMeta ( mixed | null $meta ) : Neomerx\JsonApi\Contracts\Encoder\EncoderInterface
$meta mixed | null
Результат Neomerx\JsonApi\Contracts\Encoder\EncoderInterface