<commit_before><?php

namespace JMS\SerializerBundle\DependencyInjection\Compiler;

use JMS\SerializerBundle\Serializer\EventDispatcher\EventDispatcher;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        $listeners = array();
        foreach ($container->findTaggedServiceIds('jms_serializer.event_listener') as $id => $tags) {
            if (!$container->getDefinition($id)->isPublic()) {
                throw new \RuntimeException(sprintf('The tag "jms_serializer.event_listener" of service "%s" requires the service to be public.', $id));
            }

            foreach ($tags as $attributes) {
                if ( ! isset($attributes['event'])) {
                    throw new \RuntimeException(sprintf('The tag "jms_serializer.event_listener" of service "%s" requires an attribute named "event".', $id));
                }

                $class = isset($attributes['class']) ? strtolower($attributes['class']) : null;
                $format = isset($attributes['format']) ? $attributes['format'] : null;
                $method = isset($attributes['method']) ? $attributes['method'] : EventDispatcher::getDefaultMethodName($attributes['event']);
                $priority = isset($attributes['priority']) ? (integer) $attributes['priority'] : 0;

                $listeners[$attributes['event']][$priority][] = array(array($id, $method), $class, $format);
            }
        }

        foreach ($container->findTaggedServiceIds('jms_serializer.event_subscriber') as $id => $tags) {
            $subscriberDefinition = $container->getDefinition($id);
            $subscriberClass = $subscriberDefinition->getClass();
            if ( ! is_subclass_of($subscriberClass, 'JMS\SerializerBundle\Serializer\EventDispatcher\EventSubscriberInterface')) {<commit_msg>Fix for the PHP 5.3.6 bug<commit_after><?php

namespace JMS\SerializerBundle\DependencyInjection\Compiler;

use JMS\SerializerBundle\Serializer\EventDispatcher\EventDispatcher;
use JMS\SerializerBundle\Serializer\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        $listeners = array();
        foreach ($container->findTaggedServiceIds('jms_serializer.event_listener') as $id => $tags) {
            if (!$container->getDefinition($id)->isPublic()) {
                throw new \RuntimeException(sprintf('The tag "jms_serializer.event_listener" of service "%s" requires the service to be public.', $id));
            }

            foreach ($tags as $attributes) {
                if ( ! isset($attributes['event'])) {
                    throw new \RuntimeException(sprintf('The tag "jms_serializer.event_listener" of service "%s" requires an attribute named "event".', $id));
                }

                $class = isset($attributes['class']) ? strtolower($attributes['class']) : null;
                $format = isset($attributes['format']) ? $attributes['format'] : null;
                $method = isset($attributes['method']) ? $attributes['method'] : EventDispatcher::getDefaultMethodName($attributes['event']);
                $priority = isset($attributes['priority']) ? (integer) $attributes['priority'] : 0;

                $listeners[$attributes['event']][$priority][] = array(array($id, $method), $class, $format);
            }
        }

        foreach ($container->findTaggedServiceIds('jms_serializer.event_subscriber') as $id => $tags) {
            $subscriberClass = $container->getDefinition($id)->getClass();
            $subscriberClassReflectionObj = new \ReflectionClass($subscriberClass);
            
            if ( ! $subscriberClassReflectionObj->implementsInterface('JMS\SerializerBundle\Serializer\EventDispatcher\EventSubscriberInterface') ) {
{'fraction_non_alphanumeric': 0.13251857177090823, 'fraction_numerical': 0.0011981787682722263, 'mean_word_length': 3.5969162995594712, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '984053', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1035, 'n_words': 197}