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

HandlerRegistry.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue;
8
9 use OutOfBoundsException;
10
14 class HandlerRegistry
15 {
22 protected $map = [];
23
30 public function __construct(array $map = [])
31 {
32 foreach ($map as $fieldTypeIdentifier => $handler) {
33 $this->register($fieldTypeIdentifier, $handler);
34 }
35 }
36
43 public function register($fieldTypeIdentifier, $handler)
44 {
45 $this->map[$fieldTypeIdentifier] = $handler;
46 }
47
57 public function get($fieldTypeIdentifier)
58 {
59 if (!isset($this->map[$fieldTypeIdentifier])) {
60 throw new OutOfBoundsException("No handler registered for field type '{$fieldTypeIdentifier}'.");
61 }
62
63 return $this->map[$fieldTypeIdentifier];
64 }
65
73 public function has($fieldTypeIdentifier)
74 {
75 return isset($this->map[$fieldTypeIdentifier]);
76 }
77 }
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue\HandlerRegistry
Registry for Criterion field value handlers.
Definition: HandlerRegistry.php:15
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue\HandlerRegistry\has
has($fieldTypeIdentifier)
Checks if handler is registered for the given $fieldTypeIdentifier.
Definition: HandlerRegistry.php:73
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue\HandlerRegistry\$map
$map
Definition: HandlerRegistry.php:22
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue\HandlerRegistry\__construct
__construct(array $map=[])
Create field value handler registry with handler map.
Definition: HandlerRegistry.php:30
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue
Definition: Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Converter.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.