PHP Class Neomerx\JsonApi\Encoder\Parser\Parser

Parser helps to filter resource attributes at the moment of their creation. ^^^^ This is 'sparse' JSON API feature and 'fields set' feature (for attributes) Parser does not decide if particular resource or its relationships are actually added to final JSON document. Parsing reply interpreter does this job. Parser interpreter might not include some intermediate resources that parser has found while reaching targets. ^^^^ This is 'sparse' JSON API feature again and 'fields set' feature (for relationships) The final JSON view of an element is chosen by document which uses settings to decide if 'self', 'meta', and other members should be rendered. ^^^^ This is generic JSON API features Once again, it basically works this way: - Parser finds all targeted relationships and outputs them with all intermediate results (looks like a tree). Resource attributes are already filtered. - Reply interpreter filters intermediate results and resource relationships and then send it to document. - The document is just a renderer which saves the input data in one of a few variations depending on settings. - When all data are parsed the document converts collected data to json.
Inheritance: implements Neomerx\JsonApi\Contracts\Encoder\Parser\ParserInterface
Mostra file Open project: neomerx/json-api Class Usage Examples

Protected Properties

Property Type Description
$container Neomerx\JsonApi\Contracts\Schema\ContainerInterface
$manager Neomerx\JsonApi\Contracts\Encoder\Parser\ParserManagerInterface
$parserFactory Neomerx\JsonApi\Contracts\Encoder\Parser\ParserFactoryInterface
$schemaFactory Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface
$stack Neomerx\JsonApi\Contracts\Encoder\Stack\StackInterface
$stackFactory Neomerx\JsonApi\Contracts\Encoder\Stack\StackFactoryInterface

Public Methods

Method Description
__construct ( Neomerx\JsonApi\Contracts\Encoder\Parser\ParserFactoryInterface $parserFactory, Neomerx\JsonApi\Contracts\Encoder\Stack\StackFactoryInterface $stackFactory, Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface $schemaFactory, Neomerx\JsonApi\Contracts\Schema\ContainerInterface $container, Neomerx\JsonApi\Contracts\Encoder\Parser\ParserManagerInterface $manager )
parse ( $data )

Protected Methods

Method Description
analyzeCurrentData ( ) : array
analyzeData ( array | null | object $data ) : array
getCurrentData ( ) : array | null | object

Private Methods

Method Description
checkCircular ( Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface $resourceObject ) : boolean
createReplyForEmptyData ( array | null $data ) : Neomerx\JsonApi\Contracts\Encoder\Parser\ParserReplyInterface
createReplyResourceCompleted ( ) : Neomerx\JsonApi\Contracts\Encoder\Parser\ParserReplyInterface
createReplyResourceStarted ( ) : Neomerx\JsonApi\Contracts\Encoder\Parser\ParserReplyInterface
getFieldSet ( string $resourceType ) : array
getIncludeRelationships ( ) : string[]
getSchema ( mixed $resource, Neomerx\JsonApi\Contracts\Encoder\Stack\StackFrameReadOnlyInterface $frame ) : Neomerx\JsonApi\Contracts\Schema\SchemaProviderInterface
isRelationshipIncludedOrInFieldSet ( ) : boolean
parseData ( ) : Iterator
shouldParseRelationships ( ) : boolean

Method Details

__construct() public method

public __construct ( Neomerx\JsonApi\Contracts\Encoder\Parser\ParserFactoryInterface $parserFactory, Neomerx\JsonApi\Contracts\Encoder\Stack\StackFactoryInterface $stackFactory, Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface $schemaFactory, Neomerx\JsonApi\Contracts\Schema\ContainerInterface $container, Neomerx\JsonApi\Contracts\Encoder\Parser\ParserManagerInterface $manager )
$parserFactory Neomerx\JsonApi\Contracts\Encoder\Parser\ParserFactoryInterface
$stackFactory Neomerx\JsonApi\Contracts\Encoder\Stack\StackFactoryInterface
$schemaFactory Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface
$container Neomerx\JsonApi\Contracts\Schema\ContainerInterface
$manager Neomerx\JsonApi\Contracts\Encoder\Parser\ParserManagerInterface

analyzeCurrentData() protected method

protected analyzeCurrentData ( ) : array
return array

analyzeData() protected method

protected analyzeData ( array | null | object $data ) : array
$data array | null | object
return array

getCurrentData() protected method

protected getCurrentData ( ) : array | null | object
return array | null | object

parse() public method

public parse ( $data )

Property Details

$container protected_oe property

protected ContainerInterface,Neomerx\JsonApi\Contracts\Schema $container
return Neomerx\JsonApi\Contracts\Schema\ContainerInterface

$manager protected_oe property

protected ParserManagerInterface,Neomerx\JsonApi\Contracts\Encoder\Parser $manager
return Neomerx\JsonApi\Contracts\Encoder\Parser\ParserManagerInterface

$parserFactory protected_oe property

protected ParserFactoryInterface,Neomerx\JsonApi\Contracts\Encoder\Parser $parserFactory
return Neomerx\JsonApi\Contracts\Encoder\Parser\ParserFactoryInterface

$schemaFactory protected_oe property

protected SchemaFactoryInterface,Neomerx\JsonApi\Contracts\Schema $schemaFactory
return Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface

$stack protected_oe property

protected StackInterface,Neomerx\JsonApi\Contracts\Encoder\Stack $stack
return Neomerx\JsonApi\Contracts\Encoder\Stack\StackInterface

$stackFactory protected_oe property

protected StackFactoryInterface,Neomerx\JsonApi\Contracts\Encoder\Stack $stackFactory
return Neomerx\JsonApi\Contracts\Encoder\Stack\StackFactoryInterface