Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

FieldTypeProcessorRegistry.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Common;
8
12 class FieldTypeProcessorRegistry
13 {
19 private $processors = [];
20
24 public function __construct(array $processors = [])
25 {
26 foreach ($processors as $fieldTypeIdentifier => $processor) {
27 $this->registerProcessor($fieldTypeIdentifier, $processor);
28 }
29 }
30
37 public function registerProcessor($fieldTypeIdentifier, FieldTypeProcessor $processor)
38 {
39 $this->processors[$fieldTypeIdentifier] = $processor;
40 }
41
49 public function hasProcessor($fieldTypeIdentifier)
50 {
51 return isset($this->processors[$fieldTypeIdentifier]);
52 }
53
63 public function getProcessor($fieldTypeIdentifier)
64 {
65 if (!$this->hasProcessor($fieldTypeIdentifier)) {
66 throw new \RuntimeException(
67 "No field type processor for '{$fieldTypeIdentifier}' found."
68 );
69 }
70
71 return $this->processors[$fieldTypeIdentifier];
72 }
73 }
eZ\Publish\Core\REST\Common\FieldTypeProcessorRegistry
FieldTypeProcessorRegistry.
Definition: FieldTypeProcessorRegistry.php:13
eZ\Publish\Core\REST\Common\FieldTypeProcessorRegistry\hasProcessor
hasProcessor($fieldTypeIdentifier)
Returns if a processor is registered for $fieldTypeIdentifier.
Definition: FieldTypeProcessorRegistry.php:49
eZ\Publish\Core\REST\Common\FieldTypeProcessorRegistry\__construct
__construct(array $processors=[])
Definition: FieldTypeProcessorRegistry.php:24
eZ\Publish\Core\REST\Common\FieldTypeProcessorRegistry\$processors
$processors
Definition: FieldTypeProcessorRegistry.php:19
eZ\Publish\Core\REST\Common\FieldTypeProcessorRegistry\getProcessor
getProcessor($fieldTypeIdentifier)
Returns the processor for $fieldTypeIdentifier.
Definition: FieldTypeProcessorRegistry.php:63
eZ\Publish\Core\REST\Common\FieldTypeProcessorRegistry\registerProcessor
registerProcessor($fieldTypeIdentifier, FieldTypeProcessor $processor)
Registers $processor for $fieldTypeIdentifier.
Definition: FieldTypeProcessorRegistry.php:37
eZ\Publish\Core\REST\Common\FieldTypeProcessor
FieldTypeProcessor.
Definition: FieldTypeProcessor.php:13
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.