<commit_before><?php

namespace NotificationChannels\ExpoPushNotifications;

use ExponentPhpSDK\Expo;
use ExponentPhpSDK\ExpoRegistrar;
use ExponentPhpSDK\ExpoRepository;
use Illuminate\Support\ServiceProvider;
use ExponentPhpSDK\Repositories\ExpoFileDriver;
use NotificationChannels\ExpoPushNotifications\Repositories\ExpoDatabaseDriver;

class ExpoPushNotificationsServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     */
    public function boot()
    {
        $this->publishes([
            __DIR__.'/../config/exponent-push-notifications.php' => config_path('exponent-push-notifications.php'),
        ], 'config');

        $this->mergeConfigFrom(__DIR__.'/../config/exponent-push-notifications.php', 'exponent-push-notifications');

        if (! class_exists('CreateExponentPushNotificationInterestsTable')) {
            $timestamp = date('Y_m_d_His', time());
            $this->publishes([
                __DIR__.'/../migrations/create_exponent_push_notification_interests_table.php.stub' => database_path("/migrations/{$timestamp}_create_exponent_push_notification_interests_table.php"),
            ], 'migrations');
        }

        $this->app->when(ExpoChannel::class)
            ->needs(Expo::class)
            ->give(function () {
                $driver = new ExpoFileDriver();

                if (config('exponent-push-notifications.interests.driver') === 'database') {
                    $driver = new ExpoDatabaseDriver();
                }

                return new Expo(new ExpoRegistrar($driver));
            });

        //Load routes
        $this->loadRoutesFrom(__DIR__.'/Http/routes.php');
    }

    /**
     * Register the application services.
     */
    public function register()
    {
        $driverClass = ExpoFileDriver::class;

        if (config('exponent-push-notifications.interests.driver') === 'database') {
            $driverClass = ExpoDatabaseDriver::class;
        }

        $this->app->bind(ExpoRepository::class, $driverClass);
    }
}
<commit_msg>Cleanup driver determination in service provider<commit_after><?php

namespace NotificationChannels\ExpoPushNotifications;

use ExponentPhpSDK\Expo;
use ExponentPhpSDK\ExpoRegistrar;
use ExponentPhpSDK\ExpoRepository;
use Illuminate\Support\ServiceProvider;
use ExponentPhpSDK\Repositories\ExpoFileDriver;
use NotificationChannels\ExpoPushNotifications\Repositories\ExpoDatabaseDriver;

class ExpoPushNotificationsServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     */
    public function boot()
    {
        $this->publishes([
            __DIR__.'/../config/exponent-push-notifications.php' => config_path('exponent-push-notifications.php'),
        ], 'config');

        $this->mergeConfigFrom(__DIR__.'/../config/exponent-push-notifications.php', 'exponent-push-notifications');

        if (! class_exists('CreateExponentPushNotificationInterestsTable')) {
            $timestamp = date('Y_m_d_His', time());
            $this->publishes([
                __DIR__.'/../migrations/create_exponent_push_notification_interests_table.php.stub' => database_path("/migrations/{$timestamp}_create_exponent_push_notification_interests_table.php"),
            ], 'migrations');
        }

        $this->app->when(ExpoChannel::class)
            ->needs(Expo::class)
            ->give(function () {
                return new Expo(new ExpoRegistrar($this->getInterestsDriver()));
            });

        //Load routes
        $this->loadRoutesFrom(__DIR__.'/Http/routes.php');
    }

    /**
     * Register the application services.
     */
    public function register()
    {
        $this->app->bind(ExpoRepository::class, get_class($this->getInterestsDriver()));
    }

    /**
     * @return ExpoRepository
     */
    public function getInterestsDriver()
    {
        $driver = config('exponent-push-notifications.interests.driver');

        switch ($driver) {
            case 'database':
                $class = new ExpoDatabaseDriver();
                break;
            default:
                $class = new ExpoFileDriver();
        }

        return $class;
    }
}
{'fraction_non_alphanumeric': 0.12616487455197134, 'fraction_numerical': 0.0, 'mean_word_length': 2.7542600896860985, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '2263931', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1168, 'n_words': 162}