Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. GetSetMethodNormalizer.php

function GetSetMethodNormalizer::isGetMethod

Checks if a method's name matches /^(get|is|has).+$/ and can be called non-statically without parameters.

3 calls to GetSetMethodNormalizer::isGetMethod()
GetSetMethodNormalizer::extractAttributes in vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php
Extracts attributes to normalize from the class of the given object, format and context.
GetSetMethodNormalizer::isAllowedAttribute in vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php
Is this attribute allowed?
GetSetMethodNormalizer::supports in vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php
Checks if the given class has any getter or setter method.

File

vendor/symfony/serializer/Normalizer/GetSetMethodNormalizer.php, line 85

Class

GetSetMethodNormalizer
Converts between objects with getter and setter methods and arrays.

Namespace

Symfony\Component\Serializer\Normalizer

Code

private function isGetMethod(\ReflectionMethod $method) : bool {
    return !$method->isStatic() && !($method->getAttributes(Ignore::class) || $method->getAttributes(LegacyIgnore::class)) && !$method->getNumberOfRequiredParameters() && (2 < ($methodLength = \strlen($method->name)) && str_starts_with($method->name, 'is') && !ctype_lower($method->name[2]) || 3 < $methodLength && (str_starts_with($method->name, 'has') || str_starts_with($method->name, 'get')) && !ctype_lower($method->name[3]));
}
RSS feed
Powered by Drupal