<commit_before><?php
namespace Apitude\Core\Email;

use Apitude\Core\Email\Commands\SendMessage;
use Apitude\Core\Email\Service\MandrillSender;
use Apitude\Core\Email\Service\SimpleSender;
use Apitude\Core\Provider\AbstractServiceProvider;
use Apitude\Core\Utility\Arr;
use Handlebars\Handlebars;
use Silex\Application;

class EmailServiceProvider extends AbstractServiceProvider
{
    protected $commands = [
        SendMessage::class,
    ];

    protected $services = [
        MailgunSender::class,
        MandrillSender::class,
        SimpleSender::class,
        EmailService::class,
    ];

    public function register(Application $app)
    {
        parent::register($app);
        $config = $app['config'];
        if (!isset($config['email'])) {
            $config['email'] = ['sender' => SimpleSender::class];
        }
        if (!array_key_exists('mandrill_api_key', $config['email'])) {
            if (getenv('MANDRILL_API_KEY')) {
                $config['email']['mandrill_api_key'] = getenv('MANDRILL_API_KEY');
            }
        }
        if (array_key_exists('mailgun_api_key', $config['email'])) {
            $app['mailgun'] = new Mailgun($config['email']['mailgun_api_key']);
            if (! Arr::path($config, 'email.template_path')) {
                Arr::setPath(
                    $config,
                    'email.template_path',
                    APP_PATH . '/templates'
                );
            }
            $app['handlebars'] = new Handlebars([
                'loader' => new Handlebars\Loader\FilesystemLoader(
                    $config['email']['template_path'],
                    [
                        'extension' => '.hbs',
                    ]
                ),
                'partials_loader' => new Handlebars\Loader\FilesystemLoader(
                    $config['email']['template_path'],
                    [
                        'prefix' => '_',
                    ]
                )<commit_msg>Fix use statements<commit_after><?php
namespace Apitude\Core\Email;

use Apitude\Core\Email\Commands\SendMessage;
use Apitude\Core\Email\Service\MandrillSender;
use Apitude\Core\Email\Service\SimpleSender;
use Apitude\Core\Provider\AbstractServiceProvider;
use Apitude\Core\Utility\Arr;
use Handlebars\Handlebars;
use Handlebars\Loader\FilesystemLoader;
use Mailgun\Mailgun;
use Silex\Application;

class EmailServiceProvider extends AbstractServiceProvider
{
    protected $commands = [
        SendMessage::class,
    ];

    protected $services = [
        MailgunSender::class,
        MandrillSender::class,
        SimpleSender::class,
        EmailService::class,
    ];

    public function register(Application $app)
    {
        parent::register($app);
        $config = $app['config'];
        if (!isset($config['email'])) {
            $config['email'] = ['sender' => SimpleSender::class];
        }
        if (!array_key_exists('mandrill_api_key', $config['email'])) {
            if (getenv('MANDRILL_API_KEY')) {
                $config['email']['mandrill_api_key'] = getenv('MANDRILL_API_KEY');
            }
        }
        if (array_key_exists('mailgun_api_key', $config['email'])) {
            $app['mailgun'] = new Mailgun($config['email']['mailgun_api_key']);
            if (! Arr::path($config, 'email.template_path')) {
                Arr::setPath(
                    $config,
                    'email.template_path',
                    APP_PATH . '/templates'
                );
            }
            $app['handlebars'] = new Handlebars([
                'loader' => new FilesystemLoader(
                    $config['email']['template_path'],
                    [
                        'extension' => '.hbs',
                    ]
                ),
                'partials_loader' => new FilesystemLoader(
                    $config['email']['template_path'],
                    [
                        'prefix' => '_',
                    ]
                )
{'fraction_non_alphanumeric': 0.13458646616541353, 'fraction_numerical': 0.0, 'mean_word_length': 1.871223021582734, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5506440', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1048, 'n_words': 160}