eZ\Publish\Core\REST\Common\FieldTypeProcessorRegistry::registerProcessor PHP Method

registerProcessor() public method

Registers $processor for $fieldTypeIdentifier.
public registerProcessor ( string $fieldTypeIdentifier, FieldTypeProcessor $processor )
$fieldTypeIdentifier string
$processor FieldTypeProcessor
    public function registerProcessor($fieldTypeIdentifier, FieldTypeProcessor $processor)
    {
        $this->processors[$fieldTypeIdentifier] = $processor;
    }

Usage Example

 public function testRegisterProcessorsOverwrite()
 {
     $registry = new FieldTypeProcessorRegistry();
     $processorA = $this->getAProcessorMock();
     $processorB = $this->getAProcessorMock();
     $registry->registerProcessor('my-type', $processorA);
     $registry->registerProcessor('my-type', $processorB);
     $this->assertSame($processorB, $registry->getProcessor('my-type'));
 }