chore: code refactor via rector
This commit is contained in:
@@ -38,8 +38,9 @@ class Mailbox extends Component
|
||||
$this->email = ZEmail::getEmail();
|
||||
$this->initial = false;
|
||||
if (! ZEmail::getEmail()) {
|
||||
return redirect()->route('home');
|
||||
return to_route('home');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function syncEmail($email): void
|
||||
@@ -57,7 +58,7 @@ class Mailbox extends Component
|
||||
$this->messages = [];
|
||||
}
|
||||
$responses = [];
|
||||
if (config('app.beta_feature') || ! json_decode(config('app.settings.imap_settings'))->cc_check) {
|
||||
if (config('app.beta_feature') || ! json_decode((string) config('app.settings.imap_settings'))->cc_check) {
|
||||
$responses = [
|
||||
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
|
||||
'cc' => [
|
||||
@@ -77,7 +78,7 @@ class Mailbox extends Component
|
||||
$notifications = array_merge($responses['to']['notifications'], $responses['cc']['notifications']);
|
||||
|
||||
if (count($notifications)) {
|
||||
if (! $this->overflow && count($this->messages) == $count) {
|
||||
if (! $this->overflow && count($this->messages) === $count) {
|
||||
$this->overflow = true;
|
||||
}
|
||||
} else {
|
||||
@@ -99,15 +100,15 @@ class Mailbox extends Component
|
||||
$this->initial = true;
|
||||
}
|
||||
|
||||
public function delete($messageId)
|
||||
public function delete(string $messageId): void
|
||||
{
|
||||
|
||||
try {
|
||||
if (config('app.beta_feature')) {
|
||||
Message::find($messageId)->delete();
|
||||
Message::query()->find($messageId)->delete();
|
||||
}
|
||||
if (config('app.fetch_from_db')) {
|
||||
Email::where(['message_id' => $messageId])->delete();
|
||||
Email::query()->where(['message_id' => $messageId])->delete();
|
||||
}
|
||||
$this->deleted[] = $messageId;
|
||||
foreach ($this->messages as $key => $message) {
|
||||
@@ -131,12 +132,12 @@ class Mailbox extends Component
|
||||
return view('livewire.frontend.mailbox')->with(['messages' => $this->messages, 'email' => $this->email, 'initial' => $this->initial, 'error' => $this->error]);
|
||||
}
|
||||
|
||||
private function rrmdir($dir): void
|
||||
private function rrmdir(string $dir): void
|
||||
{
|
||||
if (is_dir($dir)) {
|
||||
$objects = scandir($dir);
|
||||
foreach ($objects as $object) {
|
||||
if ($object != '.' && $object != '..') {
|
||||
if ($object !== '.' && $object !== '..') {
|
||||
if (is_dir($dir.DIRECTORY_SEPARATOR.$object) && ! is_link($dir.'/'.$object)) {
|
||||
$this->rrmdir($dir.DIRECTORY_SEPARATOR.$object);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user