<commit_before><?php
namespace DreamFactory\Core\Aws\Services;

use Aws\Ses\SesClient;
use DreamFactory\Core\Exceptions\InternalServerErrorException;
use Illuminate\Mail\Transport\SesTransport;
use DreamFactory\Library\Utility\ArrayUtils;
use DreamFactory\Core\Services\Email\BaseService;

class Ses extends BaseService
{
    /**
     * {@inheritdoc}
     */
    protected function setTransport($config)
    {
        $key = ArrayUtils::get($config, 'key');
        $secret = ArrayUtils::get($config, 'secret');
        $region = ArrayUtils::get($config, 'region', 'us-east-1');

        $this->transport = static::getTransport($key, $secret, $region);
    }

    /**
     * @param $key
     * @param $secret
     * @param $region
     *
     * @return \Illuminate\Mail\Transport\SesTransport
     * @throws \DreamFactory\Core\Exceptions\InternalServerErrorException
     */
    public static function getTransport($key, $secret, $region)
    {
        if(empty($key) || empty($secret) || empty($region)){
            throw new InternalServerErrorException('Missing one or more configuration for SES service.');
        }
        $sesClient = SesClient::factory([
            'key'    => $key,
            'secret' => $secret,
            'region' => $region
        ]);

        return new SesTransport($sesClient);
    }
}<commit_msg>fixing mail services<commit_after><?php
namespace DreamFactory\Core\Aws\Services;

use Aws\Ses\SesClient;
use DreamFactory\Core\Exceptions\InternalServerErrorException;
use Illuminate\Mail\Transport\SesTransport;
use DreamFactory\Library\Utility\ArrayUtils;
use DreamFactory\Core\Services\Email\BaseService;
use Illuminate\Support\Arr;

class Ses extends BaseService
{
    /**
     * {@inheritdoc}
     */
    protected function setTransport($config)
    {
        $key = ArrayUtils::get($config, 'key');
        $secret = ArrayUtils::get($config, 'secret');
        $region = ArrayUtils::get($config, 'region', 'us-east-1');

        $this->transport = static::getTransport($key, $secret, $region);
    }

    /**
     * @param $key
     * @param $secret
     * @param $region
     *
     * @return \Illuminate\Mail\Transport\SesTransport
     * @throws \DreamFactory\Core\Exceptions\InternalServerErrorException
     */
    public static function getTransport($key, $secret, $region)
    {
        if (empty($key) || empty($secret) || empty($region)) {
            throw new InternalServerErrorException('Missing one or more configuration for SES service.');
        }

        $config = [
            'key'     => $key,
            'secret'  => $secret,
            'region'  => $region,
            'version' => 'latest',
            'service' => 'email'
        ];

        if ($config['key'] && $config['secret']) {
            $config['credentials'] = Arr::only($config, ['key', 'secret']);
        }

        return new SesTransport(new SesClient($config));
    }
}
{'fraction_non_alphanumeric': 0.14541079408731522, 'fraction_numerical': 0.0006875214850464077, 'mean_word_length': 2.7890625, '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': '1961020', 'n_tokens_mistral': 835, 'n_tokens_neox': 845, 'n_words': 166}