<commit_before><?php

namespace Campru\GuzzleBundle\Provider;

use Silex\Application;
use Silex\ServiceProviderInterface;

/**
 * Web Profiler provider for guzzle.
 *
 * @author <NAME> <<EMAIL>>
 */
class GuzzleProfilerServiceProvider implements ServiceProviderInterface
{
    /**
     * Registers services on the given app.
     *
     * @param Application $app Silex application.
     */
    public function register(Application $app)
    {
        if (!isset($app['data_collector.templates'])) {
            throw new \LogicException(
                'The provider: "'.__CLASS__.'" must be registered after the "WebProfilerServiceProvider"'
            );
        }

        $dataCollectorTpls   = $app->raw('data_collector.templates');
        $dataCollectorTpls[] = ['guzzle', '@CampruGuzzle/views/Collector/guzzle.html.twig'];
        $app['data_collector.templates'] = $dataCollectorTpls;

        $app['guzzle_bundle.subscriber.profiler'] = $app->share(function () {
            return new \GuzzleHttp\Subscriber\History;
        });

        $app['guzzle_bundle.subscriber.storage'] = $app->share(function () {
            return new \Campru\GuzzleBundle\Subscriber\Stopwatch(new \SplObjectStorage);
        });

        $app['data_collectors'] = $app->share($app->extend('data_collectors', function ($collectors, $app) {
            $collectors['guzzle'] = function ($app) {
                return new \Campru\GuzzleBundle\DataCollector\GuzzleDataCollector(
                    $app['guzzle_bundle.subscriber.profiler'],
                    $app['guzzle_bundle.subscriber.storage']
                );
            };

            return $collectors;
        }));<commit_msg>Fix closure problem in guzzle bundle provider - In Silex web-profiler 1.0.7, data_collector.templates is a closure and   it's needed to extend to add guzzle bundle tpls<commit_after><?php

namespace Campru\GuzzleBundle\Provider;

use Silex\Application;
use Silex\ServiceProviderInterface;

/**
 * Web Profiler provider for guzzle.
 *
 * @author <NAME> <<EMAIL>>
 */
class GuzzleProfilerServiceProvider implements ServiceProviderInterface
{
    /**
     * Registers services on the given app.
     *
     * @param Application $app Silex application.
     */
    public function register(Application $app)
    {
        if (!isset($app['data_collector.templates'])) {
            throw new \LogicException(
                'The provider: "'.__CLASS__.'" must be registered after the "WebProfilerServiceProvider"'
            );
        }

        $app['data_collector.templates'] = $app->extend('data_collector.templates', function ($tpls) {
            $tpls[] = ['guzzle', '@CampruGuzzle/views/Collector/guzzle.html.twig'];

            return $tpls;
        });

        $app['guzzle_bundle.subscriber.profiler'] = $app->share(function () {
            return new \GuzzleHttp\Subscriber\History;
        });

        $app['guzzle_bundle.subscriber.storage'] = $app->share(function () {
            return new \Campru\GuzzleBundle\Subscriber\Stopwatch(new \SplObjectStorage);
        });

        $app['data_collectors'] = $app->share($app->extend('data_collectors', function ($collectors, $app) {
            $collectors['guzzle'] = function ($app) {
                return new \Campru\GuzzleBundle\DataCollector\GuzzleDataCollector(
                    $app['guzzle_bundle.subscriber.profiler'],
                    $app['guzzle_bundle.subscriber.storage']
                );
            };

            return $collectors;
        }));
{'fraction_non_alphanumeric': 0.12922465208747516, 'fraction_numerical': 0.0008520306731042318, 'mean_word_length': 2.582909460834181, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '4324339', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1001, 'n_words': 188}