Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer::extractAttributes PHP Method

extractAttributes() protected method

protected extractAttributes ( $object, $format = null, array $context = [] )
$context array
    protected function extractAttributes($object, $format = null, array $context = array())
    {
        $reflectionObject = new \ReflectionObject($object);
        $reflectionMethods = $reflectionObject->getMethods(\ReflectionMethod::IS_PUBLIC);
        $attributes = array();
        foreach ($reflectionMethods as $method) {
            if (!$this->isGetMethod($method)) {
                continue;
            }
            $attributeName = lcfirst(substr($method->name, 0 === strpos($method->name, 'is') ? 2 : 3));
            if ($this->isAllowedAttribute($object, $attributeName)) {
                $attributes[] = $attributeName;
            }
        }
        return $attributes;
    }