PHP Class Neomerx\JsonApi\Schema\Container

Inheritance: implements Neomerx\JsonApi\Contracts\Schema\ContainerInterface, implements Psr\Log\LoggerAwareInterface, use trait Psr\Log\LoggerAwareTrait
Exibir arquivo Open project: neomerx/json-api Class Usage Examples

Public Methods

Method Description
__construct ( Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface $factory, array $schemas = [] )
getSchema ( $resource )
getSchemaByResourceType ( $resourceType )
getSchemaByType ( $type )
register ( string $type, string | Closur\Closure $schema ) : void Register provider for resource type.
registerArray ( array $schemas ) : void Register providers for resource types.

Protected Methods

Method Description
createSchemaFromClassName ( string $className ) : Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface
createSchemaFromClosure ( Closure $closure ) : Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface
getCreatedProvider ( string $type ) : Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface
getFactory ( ) : Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface
getJsonType ( string $resourceType ) : string
getProviderMapping ( string $type ) : mixed
getProviderMappings ( ) : array
getResourceType ( object $resource ) : string
hasCreatedProvider ( string $type ) : boolean
hasProviderMapping ( string $type ) : boolean
hasResourceToJsonTypeMapping ( string $resourceType ) : boolean
setCreatedProvider ( string $type, Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface $provider ) : void
setProviderMapping ( string $type, string | Closur\Closure $schema ) : void
setResourceToJsonTypeMapping ( string $resourceType, string $jsonType ) : void

Method Details

__construct() public method

public __construct ( Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface $factory, array $schemas = [] )
$factory Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface
$schemas array

createSchemaFromClassName() protected method

protected createSchemaFromClassName ( string $className ) : Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface
$className string
return Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface

createSchemaFromClosure() protected method

protected createSchemaFromClosure ( Closure $closure ) : Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface
$closure Closure
return Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface

getCreatedProvider() protected method

protected getCreatedProvider ( string $type ) : Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface
$type string
return Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface

getFactory() protected method

protected getFactory ( ) : Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface
return Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface

getJsonType() protected method

protected getJsonType ( string $resourceType ) : string
$resourceType string
return string

getProviderMapping() protected method

protected getProviderMapping ( string $type ) : mixed
$type string
return mixed

getProviderMappings() protected method

protected getProviderMappings ( ) : array
return array

getResourceType() protected method

protected getResourceType ( object $resource ) : string
$resource object
return string

getSchema() public method

public getSchema ( $resource )

getSchemaByResourceType() public method

public getSchemaByResourceType ( $resourceType )

getSchemaByType() public method

public getSchemaByType ( $type )

hasCreatedProvider() protected method

protected hasCreatedProvider ( string $type ) : boolean
$type string
return boolean

hasProviderMapping() protected method

protected hasProviderMapping ( string $type ) : boolean
$type string
return boolean

hasResourceToJsonTypeMapping() protected method

protected hasResourceToJsonTypeMapping ( string $resourceType ) : boolean
$resourceType string
return boolean

register() public method

Register provider for resource type.
public register ( string $type, string | Closur\Closure $schema ) : void
$type string
$schema string | Closur\Closure
return void

registerArray() public method

Register providers for resource types.
public registerArray ( array $schemas ) : void
$schemas array
return void

setCreatedProvider() protected method

protected setCreatedProvider ( string $type, Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface $provider ) : void
$type string
$provider Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface
return void

setProviderMapping() protected method

protected setProviderMapping ( string $type, string | Closur\Closure $schema ) : void
$type string
$schema string | Closur\Closure
return void

setResourceToJsonTypeMapping() protected method

protected setResourceToJsonTypeMapping ( string $resourceType, string $jsonType ) : void
$resourceType string
$jsonType string
return void