Skip to content

Commit

Permalink
Merge branch '3.x' of github.com:BinarCode/laravel-mailator into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryk committed Jul 25, 2021
2 parents ad77c86 + 71d2ec6 commit 2fac69d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
29 changes: 14 additions & 15 deletions src/Models/MailatorSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Binarcode\LaravelMailator\Models;

use App\Domains\ResultDocuments\Models\ResultDocument;
use Binarcode\LaravelMailator\Actions\Action;
use Binarcode\LaravelMailator\Actions\ResolveGarbageAction;
use Binarcode\LaravelMailator\Actions\RunSchedulersAction;
Expand Down Expand Up @@ -106,8 +105,8 @@ public function mailable(Mailable $mailable): self
{
if ($mailable instanceof Constraintable) {
collect($mailable->constraints())
->filter(fn($constraint) => $constraint instanceof SendScheduleConstraint)
->each(fn(SendScheduleConstraint $constraint) => $this->constraint($constraint));
->filter(fn ($constraint) => $constraint instanceof SendScheduleConstraint)
->each(fn (SendScheduleConstraint $constraint) => $this->constraint($constraint));
}

$this->mailable_class = serialize($mailable);
Expand Down Expand Up @@ -318,7 +317,7 @@ public function recipients(...$recipients): self
{
$this->recipients = array_merge(collect($recipients)
->flatten()
->filter(fn($email) => $this->ensureValidEmail($email))
->filter(fn ($email) => $this->ensureValidEmail($email))
->unique()
->toArray(), $this->recipients ?? []);

Expand All @@ -344,15 +343,15 @@ public function shouldSend(): bool
try {
$this->load('logs');

if (!$this->configurationsPasses()) {
if (! $this->configurationsPasses()) {
return false;
}

if (!$this->whenPasses()) {
if (! $this->whenPasses()) {
return false;
}

if (!$this->eventsPasses()) {
if (! $this->eventsPasses()) {
if ($this->isStopable()) {
$this->markComplete();
}
Expand Down Expand Up @@ -409,7 +408,7 @@ public static function run(): void

public function hasCustomAction(): bool
{
return !is_null($this->action);
return ! is_null($this->action);
}

public function getMailable(): ?Mailable
Expand Down Expand Up @@ -464,13 +463,13 @@ public function markAsFailed(string $failureReason): self
public function getRecipients(): array
{
return collect($this->recipients)
->filter(fn($email) => $this->ensureValidEmail($email))
->filter(fn ($email) => $this->ensureValidEmail($email))
->toArray();
}

protected function ensureValidEmail(string $email): bool
{
return !Validator::make(
return ! Validator::make(
compact('email'),
['email' => 'required|email']
)->fails();
Expand All @@ -483,7 +482,7 @@ public function actionClass(Action $action): self
return $this;
}

public function tag(string|array $tag): self
public function tag(string | array $tag): self
{
if (is_array($tag)) {
$tag = implode(',', $tag);
Expand Down Expand Up @@ -534,7 +533,7 @@ public function markComplete(): self

public function isCompleted(): bool
{
return !is_null($this->completed_at);
return ! is_null($this->completed_at);
}

public function failedLastTimes(int $times): bool
Expand All @@ -556,12 +555,12 @@ public function timestampTarget(): ?CarbonInterface

public function isRepetitive(): bool
{
return !$this->isOnce();
return ! $this->isOnce();
}

public function wasSentOnce(): bool
{
return !is_null($this->last_sent_at);
return ! is_null($this->last_sent_at);
}

public function getConstraints(): ConstraintsCollection
Expand All @@ -571,7 +570,7 @@ public function getConstraints(): ConstraintsCollection

public function save(array $options = [])
{
if (!$this->isUnique()) {
if (! $this->isUnique()) {
return parent::save($options);
}

Expand Down
1 change: 0 additions & 1 deletion tests/Feature/UniqueSchedulerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Binarcode\LaravelMailator\Scheduler;
use Binarcode\LaravelMailator\Tests\database\Factories\UserFactory;
use Binarcode\LaravelMailator\Tests\Fixtures\Constraints\DynamicContraint;
use Binarcode\LaravelMailator\Tests\Fixtures\InvoiceReminderMailable;
use Binarcode\LaravelMailator\Tests\TestCase;
use Illuminate\Support\Facades\Mail;
Expand Down

0 comments on commit 2fac69d

Please sign in to comment.