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

AbstractPropertyWhitelistNormalizer.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer;
8
9 use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
10
11 abstract class AbstractPropertyWhitelistNormalizer extends PropertyNormalizer
12 {
13 public function normalize($object, $format = null, array $context = [])
14 {
15 $data = parent::normalize($object, $format, $context);
16 foreach (array_keys($data) as $property) {
17 if (!in_array($property, $this->getAllowedProperties())) {
18 unset($data[$property]);
19 }
20 }
21
22 return $data;
23 }
24
28 abstract protected function getAllowedProperties();
29 }
eZ\Publish\Core\MVC\Symfony\Component\Serializer\AbstractPropertyWhitelistNormalizer
Definition: AbstractPropertyWhitelistNormalizer.php:12
eZ\Publish\Core\MVC\Symfony\Component\Serializer\AbstractPropertyWhitelistNormalizer\getAllowedProperties
getAllowedProperties()
eZ\Publish\Core\MVC\Symfony\Component\Serializer\AbstractPropertyWhitelistNormalizer\normalize
normalize($object, $format=null, array $context=[])
Definition: AbstractPropertyWhitelistNormalizer.php:13
eZ\Publish\Core\MVC\Symfony\Component\Serializer
Definition: AbstractPropertyWhitelistNormalizer.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.