function NormalizerBase::checkFormat

Same name in this branch
  1. 8.9.x core/modules/jsonapi/src/Normalizer/NormalizerBase.php \Drupal\jsonapi\Normalizer\NormalizerBase::checkFormat()
  2. 8.9.x core/modules/hal/src/Normalizer/NormalizerBase.php \Drupal\hal\Normalizer\NormalizerBase::checkFormat()
Same name in other branches
  1. 9 core/modules/jsonapi/src/Normalizer/NormalizerBase.php \Drupal\jsonapi\Normalizer\NormalizerBase::checkFormat()
  2. 9 core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::checkFormat()
  3. 10 core/modules/jsonapi/src/Normalizer/NormalizerBase.php \Drupal\jsonapi\Normalizer\NormalizerBase::checkFormat()
  4. 10 core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::checkFormat()
  5. 11.x core/modules/jsonapi/src/Normalizer/NormalizerBase.php \Drupal\jsonapi\Normalizer\NormalizerBase::checkFormat()
  6. 11.x core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::checkFormat()

Checks if the provided format is supported by this normalizer.

Parameters

string $format: The format to check.

Return value

bool TRUE if the format is supported, FALSE otherwise. If no format is specified this will return TRUE.

3 calls to NormalizerBase::checkFormat()
NormalizerBase::checkFormat in core/modules/hal/src/Normalizer/NormalizerBase.php
Checks if the provided format is supported by this normalizer.
NormalizerBase::supportsDenormalization in core/modules/serialization/src/Normalizer/NormalizerBase.php
Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()
NormalizerBase::supportsNormalization in core/modules/serialization/src/Normalizer/NormalizerBase.php
2 methods override NormalizerBase::checkFormat()
NormalizerBase::checkFormat in core/modules/jsonapi/src/Normalizer/NormalizerBase.php
Checks if the provided format is supported by this normalizer.
NormalizerBase::checkFormat in core/modules/hal/src/Normalizer/NormalizerBase.php
Checks if the provided format is supported by this normalizer.

File

core/modules/serialization/src/Normalizer/NormalizerBase.php, line 79

Class

NormalizerBase
Base class for Normalizers.

Namespace

Drupal\serialization\Normalizer

Code

protected function checkFormat($format = NULL) {
    if (!isset($format) || !isset($this->format)) {
        return TRUE;
    }
    return in_array($format, (array) $this->format, TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.