<commit_before><?php

namespace MtMail\Factory;


use MtMail\ComposerPlugin\Layout;
use MtMail\Service\Composer;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class ComposerServiceFactory implements FactoryInterface
{

    /**
     * Create service
     *
     * @param ServiceLocatorInterface $serviceLocator
     * @return Composer
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $configuration = $serviceLocator->get('Configuration');
        $renderer = $configuration['mt_mail']['renderer'];
        $service = new Composer($serviceLocator->get($renderer));

        $enabledPlugins = array();

        // trigger E_DEPRECATED if old configuration key is used
        // TODO: remove this in 1.0-stable version
        if (isset($configuration['mt_mail']['plugins']) && is_array($configuration['mt_mail']['plugins'])) {
            trigger_error(
                "'plugins' configuration key is now deprecated and should be replaced with 'composer_plugins'",
                E_DEPRECATED
            );
            $enabledPlugins = $configuration['mt_mail']['plugins'];
        }

        if (isset($configuration['mt_mail']['composer_plugins'])
            && is_array($configuration['mt_mail']['composer_plugins'])
        ) {
            $enabledPlugins = array_merge($enabledPlugins, $configuration['mt_mail']['composer_plugins']);
        }

        $pluginManager = $serviceLocator->get('MtMail\ComposerPlugin\Manager');

        foreach ($enabledPlugins as $plugin) {
            $service->getEventManager()->attachAggregate($pluginManager->get($plugin));
        }

        return $service;
    }
}
<commit_msg>trigger E_USER_DEPRECATED<commit_after><?php

namespace MtMail\Factory;


use MtMail\ComposerPlugin\Layout;
use MtMail\Service\Composer;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class ComposerServiceFactory implements FactoryInterface
{

    /**
     * Create service
     *
     * @param ServiceLocatorInterface $serviceLocator
     * @return Composer
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $configuration = $serviceLocator->get('Configuration');
        $renderer = $configuration['mt_mail']['renderer'];
        $service = new Composer($serviceLocator->get($renderer));

        $enabledPlugins = array();

        // trigger E_DEPRECATED if old configuration key is used
        // TODO: remove this in 1.0-stable version
        if (isset($configuration['mt_mail']['plugins']) && is_array($configuration['mt_mail']['plugins'])) {
            trigger_error(
                "'plugins' configuration key is now deprecated and should be replaced with 'composer_plugins'",
                E_USER_DEPRECATED
            );
            $enabledPlugins = $configuration['mt_mail']['plugins'];
        }

        if (isset($configuration['mt_mail']['composer_plugins'])
            && is_array($configuration['mt_mail']['composer_plugins'])
        ) {
            $enabledPlugins = array_merge($enabledPlugins, $configuration['mt_mail']['composer_plugins']);
        }

        $pluginManager = $serviceLocator->get('MtMail\ComposerPlugin\Manager');

        foreach ($enabledPlugins as $plugin) {
            $service->getEventManager()->attachAggregate($pluginManager->get($plugin));
        }

        return $service;
    }
}

{'fraction_non_alphanumeric': 0.12322823257159386, 'fraction_numerical': 0.0011570726063060456, 'mean_word_length': 3.176328502415459, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '925153', 'n_tokens_mistral': 913, 'n_tokens_neox': 890, 'n_words': 167}