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

Core/REST/Client/FieldTypeService.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Client;
8
9 use eZ\Publish\API\Repository\FieldTypeService as APIFieldTypeService;
10 use eZ\Publish\Core\REST\Common\Exceptions;
11
12 class FieldTypeService implements APIFieldTypeService
13 {
19 protected $fieldTypes = array();
20
24 public function __construct(array $fieldTypes = array())
25 {
26 foreach ($fieldTypes as $fieldType) {
27 $this->addFieldType($fieldType);
28 }
29 }
30
38 public function addFieldType(FieldType $fieldType)
39 {
40 $this->fieldTypes[$fieldType->getFieldTypeIdentifier()] = $fieldType;
41 }
42
48 public function getFieldTypes()
49 {
50 return array_values($this->fieldTypes);
51 }
52
63 public function getFieldType($identifier)
64 {
65 if ($this->hasFieldType($identifier)) {
66 return $this->fieldTypes[$identifier];
67 }
68
69 throw new Exceptions\NotFoundException(
70 sprintf(
71 'FieldType with identifier "%s" not found.',
72 $identifier
73 )
74 );
75 }
76
84 public function hasFieldType($identifier)
85 {
86 return isset($this->fieldTypes[$identifier]);
87 }
88 }
eZ\Publish\Core\REST\Client\FieldTypeService
Definition: Core/REST/Client/FieldTypeService.php:13
eZ\Publish\Core\REST\Client\FieldTypeService\hasFieldType
hasFieldType($identifier)
Returns if there is a FieldType registered under $identifier.
Definition: Core/REST/Client/FieldTypeService.php:84
eZ\Publish\Core\REST\Client\FieldTypeService\__construct
__construct(array $fieldTypes=array())
Definition: Core/REST/Client/FieldTypeService.php:24
eZ\Publish\Core\REST\Client\FieldTypeService\$fieldTypes
$fieldTypes
Definition: Core/REST/Client/FieldTypeService.php:19
eZ\Publish\Core\REST\Client\FieldTypeService\getFieldTypes
getFieldTypes()
Returns a list of all field types.
Definition: Core/REST/Client/FieldTypeService.php:48
eZ\Publish\Core\REST\Client\FieldTypeService\getFieldType
getFieldType($identifier)
Returns the FieldType registered with the given identifier.
Definition: Core/REST/Client/FieldTypeService.php:63
eZ\Publish\Core\REST\Client\FieldTypeService\addFieldType
addFieldType(FieldType $fieldType)
Adds the given $fieldType.
Definition: Core/REST/Client/FieldTypeService.php:38
eZ\Publish\Core\REST\Client\FieldType
Definition: Core/REST/Client/FieldType.php:15
eZ\Publish\Core\REST\Client\FieldType\getFieldTypeIdentifier
getFieldTypeIdentifier()
Returns the field type identifier for this field type.
Definition: Core/REST/Client/FieldType.php:36
eZ\Publish\API\Repository\FieldTypeService
An implementation of this class provides access to FieldTypes.
Definition: API/Repository/FieldTypeService.php:15
eZ\Publish\Core\REST\Client
Definition: Core/REST/Client/ContentService.php:7
eZ\Publish\Core\REST\Common\Exceptions
Definition: Core/REST/Common/Exceptions/ForbiddenException.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.