PHP Класс Spatie\Fractal\Fractal

Наследование: implements JsonSerializabl\JsonSerializable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$cursor League\Fractal\Pagination\CursorInterface
$data mixed
$dataType string
$excludes array
$includes array
$manager League\Fractal\Manager
$meta array
$paginator League\Fractal\Pagination\PaginatorInterface
$resourceName string
$serializer League\Fractal\Serializer\SerializerAbstract
$transformer League\Fractal\TransformerAbstract | callable

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

Метод Описание
__call ( string $name, array $arguments ) Support for magic methods to included data.
__construct ( League\Fractal\Manager $manager )
addMeta ( ) Set the meta data.
collection ( mixed $data, League\Fractal\TransformerAbstract | callable | null $transformer = null, string | null $resourceName = null ) Set the collection data that must be transformed.
createData ( ) : League\Fractal\Scope Create fractal data.
data ( string $dataType, mixed $data, League\Fractal\TransformerAbstract | callable | null $transformer = null ) Set the data that must be transformed.
getResource ( ) : League\Fractal\Resource\ResourceInterface Get the resource.
item ( mixed $data, League\Fractal\TransformerAbstract | callable | null $transformer = null, string | null $resourceName = null ) Set the item data that must be transformed.
jsonSerialize ( ) Convert the object into something JSON serializable.
paginateWith ( League\Fractal\Pagination\PaginatorInterface $paginator ) Set a Fractal paginator for the data.
parseExcludes ( array | string $excludes ) Specify the excludes.
parseIncludes ( array | string $includes ) Specify the includes.
serializeWith ( League\Fractal\Serializer\SerializerAbstract $serializer ) Set the serializer to be used.
toArray ( ) : array Perform the transformation to array.
toJson ( ) : string Perform the transformation to json.
transformWith ( League\Fractal\TransformerAbstract | callable $transformer ) Set the class or function that will perform the transform.
withCursor ( League\Fractal\Pagination\CursorInterface $cursor ) Set a Fractal cursor for the data.
withResourceName ( string $resourceName ) Set the resource name, to replace 'data' as the root of the collection or item.

Защищенные методы

Метод Описание
normalizeIncludesOrExcludes ( array | string $includesOrExcludes = '' ) : array | string Normalize the includes an excludes.

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

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

Support for magic methods to included data.
public __call ( string $name, array $arguments )
$name string
$arguments array

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

public __construct ( League\Fractal\Manager $manager )
$manager League\Fractal\Manager

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

Set the meta data.
public addMeta ( )

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

Set the collection data that must be transformed.
public collection ( mixed $data, League\Fractal\TransformerAbstract | callable | null $transformer = null, string | null $resourceName = null )
$data mixed
$transformer League\Fractal\TransformerAbstract | callable | null
$resourceName string | null

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

Create fractal data.
public createData ( ) : League\Fractal\Scope
Результат League\Fractal\Scope

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

Set the data that must be transformed.
public data ( string $dataType, mixed $data, League\Fractal\TransformerAbstract | callable | null $transformer = null )
$dataType string
$data mixed
$transformer League\Fractal\TransformerAbstract | callable | null

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

Get the resource.
public getResource ( ) : League\Fractal\Resource\ResourceInterface
Результат League\Fractal\Resource\ResourceInterface

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

Set the item data that must be transformed.
public item ( mixed $data, League\Fractal\TransformerAbstract | callable | null $transformer = null, string | null $resourceName = null )
$data mixed
$transformer League\Fractal\TransformerAbstract | callable | null
$resourceName string | null

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

Convert the object into something JSON serializable.
public jsonSerialize ( )

normalizeIncludesOrExcludes() защищенный Метод

Normalize the includes an excludes.
protected normalizeIncludesOrExcludes ( array | string $includesOrExcludes = '' ) : array | string
$includesOrExcludes array | string
Результат array | string

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

Set a Fractal paginator for the data.
public paginateWith ( League\Fractal\Pagination\PaginatorInterface $paginator )
$paginator League\Fractal\Pagination\PaginatorInterface

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

Specify the excludes.
public parseExcludes ( array | string $excludes )
$excludes array | string Array or string of resources to exclude.

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

Specify the includes.
public parseIncludes ( array | string $includes )
$includes array | string Array or string of resources to include.

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

Set the serializer to be used.
public serializeWith ( League\Fractal\Serializer\SerializerAbstract $serializer )
$serializer League\Fractal\Serializer\SerializerAbstract

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

Perform the transformation to array.
public toArray ( ) : array
Результат array

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

Perform the transformation to json.
public toJson ( ) : string
Результат string

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

Set the class or function that will perform the transform.
public transformWith ( League\Fractal\TransformerAbstract | callable $transformer )
$transformer League\Fractal\TransformerAbstract | callable

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

Set a Fractal cursor for the data.
public withCursor ( League\Fractal\Pagination\CursorInterface $cursor )
$cursor League\Fractal\Pagination\CursorInterface

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

Set the resource name, to replace 'data' as the root of the collection or item.
public withResourceName ( string $resourceName )
$resourceName string

Описание свойств

$cursor защищенное свойство

protected CursorInterface,League\Fractal\Pagination $cursor
Результат League\Fractal\Pagination\CursorInterface

$data защищенное свойство

protected mixed $data
Результат mixed

$dataType защищенное свойство

protected string $dataType
Результат string

$excludes защищенное свойство

protected array $excludes
Результат array

$includes защищенное свойство

protected array $includes
Результат array

$manager защищенное свойство

protected Manager,League\Fractal $manager
Результат League\Fractal\Manager

$meta защищенное свойство

protected array $meta
Результат array

$paginator защищенное свойство

protected PaginatorInterface,League\Fractal\Pagination $paginator
Результат League\Fractal\Pagination\PaginatorInterface

$resourceName защищенное свойство

protected string $resourceName
Результат string

$serializer защищенное свойство

protected SerializerAbstract,League\Fractal\Serializer $serializer
Результат League\Fractal\Serializer\SerializerAbstract

$transformer защищенное свойство

protected TransformerAbstract,League\Fractal|callable $transformer
Результат League\Fractal\TransformerAbstract | callable