HEX
Server: Apache/2.4.41
System: Linux mainweb 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 x86_64
User: nationalmedicaregrp (1119)
PHP: 8.3.7
Disabled: exec,passthru,shell_exec,system,popen,proc_open,pcntl_exec
Upload Files
File: /home/dv-pro/public_html/wp-content/plugins/fluent-smtp/app/Services/Mailer/Providers/Factory.php
<?php

namespace FluentMail\App\Services\Mailer\Providers;

use InvalidArgumentException;
use FluentMail\App\Models\Settings;
use FluentMail\Includes\Core\Application;

class Factory
{
    protected $app = null;

    protected $settings = null;

    public function __construct(Application $app, Settings $settings)
    {
        $this->app = $app;
        
        $this->settings = $settings;
    }

    public function make($provider)
    {
        return $this->app->make($provider);
    }

    public function get($email)
    {
        if (!($conn = $this->settings->getConnection($email))) {
            $conn = $this->getDefaultProvider();
        }
        
        if ($conn) {
            $settings = array_merge($conn['provider_settings'], [
                'title' => $conn['title']
            ]);
            
            return $this->make(
                $conn['provider_settings']['provider']
            )->setSettings($settings);
        }
        

        throw new InvalidArgumentException(
            esc_html__('There is no matching provider found by email: ', 'fluent-smtp') . $email // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
        );
    }

    public function getDefaultProvider()
    {
        return fluentMailDefaultConnection();
    }
}