<commit_before><?php namespace Mews\Captcha;

use Illuminate\Support\ServiceProvider;
use Illuminate\Validation\Factory;

class CaptchaServiceProvider extends ServiceProvider {

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     *
     * Boot the service provider.
     *
     * @return null
     */
    public function boot()
    {
        $this->publishes([
           __DIR__.'/../config/captcha.php' => config_path('captcha.php')
        ]);
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom(
            __DIR__.'/../config/captcha.php', 'mews.captcha'
        );

        /**
         * @param $app
         * @return Captcha
         */
        $this->app->bind('captcha', function($app)
        {
            return new Captcha(
                $app['Illuminate\Filesystem\Filesystem'],
                $app['Illuminate\Config\Repository'],
                $app['Intervention\Image\ImageManager'],
                $app['Illuminate\Session\Store'],
                $app['Illuminate\Hashing\BcryptHasher'],
                $app['Illuminate\Support\Str']
            );
        });

        /**
         * @param Captcha $captcha
         * @return \Intervention\Image\ImageManager
         */
        $this->app['router']->get('captcha', function(Captcha $captcha)
        {
            return $captcha->create();
        });

        /**
         * @param Captcha $captcha
         * @param $config
         * @return \Intervention\Image\ImageManager
         */
        $this->app['router']->get('captcha/{config}', function(Captcha $captcha, $config)
        {
            return $captcha->create($config);
        });

        $this->app['validator'] = $this->app->share(function($app) {
            $validator = new Factory($app['translator']);
            $validator->resolver(function($translator, $data, $rules, $messages) {
                return new CaptchaValidator($translator, $data, $rules, $messages);
            });
            return $validator;
        });<commit_msg>Validator bugfix<commit_after><?php namespace Mews\Captcha;

use Illuminate\Support\ServiceProvider;
use Illuminate\Validation\Factory;

class CaptchaServiceProvider extends ServiceProvider {

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     *
     * Boot the service provider.
     *
     * @return null
     */
    public function boot()
    {
        $this->publishes([
           __DIR__.'/../config/captcha.php' => config_path('captcha.php')
        ]);
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom(
            __DIR__.'/../config/captcha.php', 'mews.captcha'
        );

        /**
         * @param $app
         * @return Captcha
         */
        $this->app->bind('captcha', function($app)
        {
            return new Captcha(
                $app['Illuminate\Filesystem\Filesystem'],
                $app['Illuminate\Config\Repository'],
                $app['Intervention\Image\ImageManager'],
                $app['Illuminate\Session\Store'],
                $app['Illuminate\Hashing\BcryptHasher'],
                $app['Illuminate\Support\Str']
            );
        });

        /**
         * @param Captcha $captcha
         * @return \Intervention\Image\ImageManager
         */
        $this->app['router']->get('captcha', function(Captcha $captcha)
        {
            return $captcha->create();
        });

        /**
         * @param Captcha $captcha
         * @param $config
         * @return \Intervention\Image\ImageManager
         */
        $this->app['router']->get('captcha/{config}', function(Captcha $captcha, $config)
        {
            return $captcha->create($config);
        });

        $this->app['validator'] = $this->app->share(function($app) {
            $validator = new Factory($app['translator']);
            $validator->setPresenceVerifier($this->app['validation.presence']);
            $validator->resolver(function($translator, $data, $rules, $messages) {
                return new CaptchaValidator($translator, $data, $rules, $messages);
            });
            return $validator;
        });
{'fraction_non_alphanumeric': 0.147052230441605, 'fraction_numerical': 0.0, 'mean_word_length': 1.7714285714285714, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '4097968', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1237, 'n_words': 208}