Skip to content

Commit

Permalink
🩹 fix: Correct class path
Browse files Browse the repository at this point in the history
'Roots\AcornMail\' does not correctly reflect the class path
  • Loading branch information
tombroucke committed Sep 25, 2024
1 parent a65ef81 commit 797ba56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/AcornMailServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AcornMailServiceProvider extends ServiceProvider
*/
public function register()
{
$this->app->singleton('Roots\AcornMail', fn () => AcornMail::make($this->app));
$this->app->singleton(AcornMail::class, fn () => AcornMail::make($this->app));
}

/**
Expand All @@ -30,6 +30,6 @@ public function boot()
]);
}

$this->app->make('Roots\AcornMail');
$this->app->make(AcornMail::class);
}
}
13 changes: 6 additions & 7 deletions src/Console/Commands/MailTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Command;
use Illuminate\Support\Str;
use Roots\AcornMail\AcornMail;

class MailTestCommand extends Command
{
Expand All @@ -13,9 +14,7 @@ class MailTestCommand extends Command
* @var string
*/
protected $signature = 'mail:test
{--to= : The email address to send the test email to.}
{--subject=Test email : The subject of the test email}
{--body=This is a test email from WordPress. : The body of the test email}';
{--to= : The email address to send the test email to.}';

/**
* The console command description.
Expand Down Expand Up @@ -49,7 +48,7 @@ class MailTestCommand extends Command
*/
public function handle()
{
$package = app('Roots\AcornMail');
$package = app()->make(AcornMail::class);

if (! $package->configured()) {
$this->components->error('The mail SMTP configuration is not set.');
Expand All @@ -66,7 +65,7 @@ public function handle()
$config = collect($phpmailer)
->filter(fn ($value, $key) => in_array($key, array_keys($this->options)))
->map(fn ($value, $key) => $key === 'Password' ? Str::mask($value, '*', 0) : $value)
->map(fn ($value, $key) => Str::finish($this->options[$key], ': ').(is_null($value) || empty($value) ? 'Not set' : "<fg=blue>{$value}</>"));
->map(fn ($value, $key) => Str::finish($this->options[$key], ': ') . (is_null($value) || empty($value) ? 'Not set' : "<fg=blue>{$value}</>"));

$this->components->bulletList($config);
});
Expand All @@ -83,8 +82,8 @@ public function handle()

$mail = wp_mail(
$recipient,
$this->option('subject'),
$this->option('body')
'Test Email',
'This is a test email from WordPress.'
);

if ($mail) {
Expand Down

0 comments on commit 797ba56

Please sign in to comment.