Use ObjectIssetFix Trait instead of defining __isset() directly
This commit is contained in:
parent
8590bb8acc
commit
27a3e3e24e
@ -13,7 +13,7 @@ use Illuminate\Validation\Validator as ValidatorResult;
|
|||||||
use App\Classes\FTN as FTNBase;
|
use App\Classes\FTN as FTNBase;
|
||||||
use App\Models\{Address,Domain,Zone};
|
use App\Models\{Address,Domain,Zone};
|
||||||
use App\Rules\{TwoByteInteger,TwoByteIntegerWithZero};
|
use App\Rules\{TwoByteInteger,TwoByteIntegerWithZero};
|
||||||
use App\Traits\EncodeUTF8;
|
use App\Traits\{EncodeUTF8,ObjectIssetFix};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Message
|
* Class Message
|
||||||
@ -24,7 +24,7 @@ use App\Traits\EncodeUTF8;
|
|||||||
*/
|
*/
|
||||||
class Message extends FTNBase
|
class Message extends FTNBase
|
||||||
{
|
{
|
||||||
use EncodeUTF8;
|
use EncodeUTF8,ObjectIssetFix;
|
||||||
|
|
||||||
private const LOGKEY = 'FM-';
|
private const LOGKEY = 'FM-';
|
||||||
|
|
||||||
@ -225,12 +225,6 @@ class Message extends FTNBase
|
|||||||
$this->unknown = collect();
|
$this->unknown = collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix for a call to pluck('date') (which is resolved via __get()), but it returns false.
|
|
||||||
public function __isset($key)
|
|
||||||
{
|
|
||||||
return (bool)$this->{$key};
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __get($key)
|
public function __get($key)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Cache\Repository;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
@ -11,7 +10,6 @@ use Illuminate\Queue\InteractsWithQueue;
|
|||||||
use Illuminate\Queue\ManuallyFailedException;
|
use Illuminate\Queue\ManuallyFailedException;
|
||||||
use Illuminate\Queue\MaxAttemptsExceededException;
|
use Illuminate\Queue\MaxAttemptsExceededException;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Facades\Cache;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
|
|
||||||
@ -21,18 +19,17 @@ use App\Classes\Sock\SocketClient;
|
|||||||
use App\Classes\Sock\SocketException;
|
use App\Classes\Sock\SocketException;
|
||||||
use App\Models\{Address,Mailer,Setup};
|
use App\Models\{Address,Mailer,Setup};
|
||||||
use App\Notifications\Netmails\PollingFailed;
|
use App\Notifications\Netmails\PollingFailed;
|
||||||
|
use App\Traits\ObjectIssetFix;
|
||||||
|
|
||||||
class AddressPoll implements ShouldQueue, ShouldBeUnique
|
class AddressPoll implements ShouldQueue, ShouldBeUnique
|
||||||
{
|
{
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, ObjectIssetFix;
|
||||||
|
|
||||||
private const LOGKEY = 'JAP';
|
private const LOGKEY = 'JAP';
|
||||||
|
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
public int $tries = 5;
|
||||||
|
public int $maxExceptions = 1;
|
||||||
public $tries = 5;
|
public bool $failOnTimeout = TRUE;
|
||||||
|
|
||||||
public $maxExceptions = 1;
|
|
||||||
|
|
||||||
public $failOnTimeout = TRUE;
|
|
||||||
|
|
||||||
public const QUEUE = 'poll';
|
public const QUEUE = 'poll';
|
||||||
|
|
||||||
@ -61,19 +58,6 @@ class AddressPoll implements ShouldQueue, ShouldBeUnique
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Because pluck doesnt return __get() defined vars
|
|
||||||
*
|
|
||||||
* @param $key
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function __isset($key): bool
|
|
||||||
{
|
|
||||||
$keys = ['address'];
|
|
||||||
|
|
||||||
return in_array($key,$keys);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time to wait between tries
|
* Time to wait between tries
|
||||||
*
|
*
|
||||||
|
15
app/Traits/ObjectIssetFix.php
Normal file
15
app/Traits/ObjectIssetFix.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix for when there is a call to pluck() for values resolved via __get()
|
||||||
|
*/
|
||||||
|
namespace App\Traits;
|
||||||
|
|
||||||
|
trait ObjectIssetFix
|
||||||
|
{
|
||||||
|
// Fix for a call to pluck('something') (which is resolved via __get()), but it returns false.
|
||||||
|
public function __isset($key)
|
||||||
|
{
|
||||||
|
return (bool)$this->{$key};
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user