You are here

private function PropertyNormalizer::supports in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Normalizer/PropertyNormalizer.php \Symfony\Component\Serializer\Normalizer\PropertyNormalizer::supports()

Checks if the given class has any non-static property.

Parameters

string $class:

Return value

bool

2 calls to PropertyNormalizer::supports()
PropertyNormalizer::supportsDenormalization in vendor/symfony/serializer/Normalizer/PropertyNormalizer.php
Checks whether the given class is supported for denormalization by this normalizer.
PropertyNormalizer::supportsNormalization in vendor/symfony/serializer/Normalizer/PropertyNormalizer.php
Checks whether the given class is supported for normalization by this normalizer.

File

vendor/symfony/serializer/Normalizer/PropertyNormalizer.php, line 148

Class

PropertyNormalizer
Converts between objects and arrays by mapping properties.

Namespace

Symfony\Component\Serializer\Normalizer

Code

private function supports($class) {
  $class = new \ReflectionClass($class);

  // We look for at least one non-static property
  foreach ($class
    ->getProperties() as $property) {
    if (!$property
      ->isStatic()) {
      return true;
    }
  }
  return false;
}