BaseResourceBuilder
class BaseResourceBuilder implements ResourceBuilderInterface
BaseResourceBuilder class.
This class is responsible for populating PHP objects using data received from Contentful's API.
Methods
ResourceBuilder constructor.
Creates or updates an object using given data.
Returns the mapper object appropriate for the given data.
Sets a callable which will receive raw data (the JSON payload converted to a PHP array) and will determine the FQCN for appropriate mapping of that resource.
Returns the namespace where mapper classes are located.
Abstract function for instantiating a mapper.
Determines the SDK resource type given the API system type.
Details
at line 48
__construct()
ResourceBuilder constructor.
at line 56
ResourceInterface|ResourceArray
build(array $data, ResourceInterface $resource = null)
Creates or updates an object using given data.
This method will overwrite properties of the $resource parameter.
at line 74
MapperInterface
getMapper(string $fqcn)
Returns the mapper object appropriate for the given data.
at line 129
BaseResourceBuilder
setDataMapperMatcher(string $type, callable $dataMapperMatcher = null)
Sets a callable which will receive raw data (the JSON payload converted to a PHP array) and will determine the FQCN for appropriate mapping of that resource.
at line 141
abstract protected string
getMapperNamespace()
Returns the namespace where mapper classes are located.
at line 152
abstract protected MapperInterface
createMapper(string $fqcn)
Abstract function for instantiating a mapper.
This function is made abstract because different resource builders might need to create mappers with different arguments.
at line 163
abstract protected string
getSystemType(array $data)
Determines the SDK resource type given the API system type.