public function getSerializerHandledClass($serializer)
    {
        if (method_exists($serializer, 'getClass')) {
            // 1. the serializer implements the getClass method, so we just call it
            //    this is the recommended way because it's more efficient than using reflection
            return $serializer->getClass();
        } else {
            // 2. else, we try to find the correct serializer by using the type hint of the `serialize` method
            //    this is not always possible, because some serializers can not use type hint (mostly because of an Interface),
            //    so for this case the `getClass` method is required
            $p = new \ReflectionParameter([get_class($serializer), 'serialize'], 0);

            return $p->getClass()->getName();
        }
    }
public function getSerializerHandledClass($serializer)
    {
        if (method_exists($serializer, 'getClass')) {
            // 1. the serializer implements the getClass method, so we just call it
            //    this is the recommended way because it's more efficient than using reflection
            return $serializer->getClass();
        } else {
            // 2. else, we try to find the correct serializer by using the type hint of the `serialize` method
            //    this is not always possible, because some serializers can not use type hint (mostly because of an Interface),
            //    so for this case the `getClass` method is required
            $p = new \ReflectionParameter([get_class($serializer), 'serialize'], 0);

            return $p->getClass()->getName();
        }
    }
public function getSerializerHandledClass ( $ serializer ) { if ( method_exists ( $ serializer , 'getClass' ) ) { // 1. the serializer implements the getClass method, so we just call it //    this is the recommended way because it's more efficient than using reflection return $ serializer -> getClass ( ) ; } else { // 2. else, we try to find the correct serializer by using the type hint of the `serialize` method //    this is not always possible, because some serializers can not use type hint (mostly because of an Interface), //    so for this case the `getClass` method is required $ p = new \ ReflectionParameter ( [ get_class ( $ serializer ) , 'serialize' ] , 0 ) ; return $ p -> getClass ( ) -> getName ( ) ; } }
Returns the class handled by the serializer.

@param mixed $serializer

@return $string
Returns the class handled by the serializer .