clrghouz/app/Classes/FTN/Process/Echomail/Test.php

35 lines
877 B
PHP

<?php
namespace App\Classes\FTN\Process\Echomail;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\Log;
use App\Classes\FTN\{Message,Process};
use App\Notifications\Echomails\Test as TestNotification;
/**
* Process messages to Test
*
* @package App\Classes\FTN\Process
*/
final class Test extends Process
{
private const LOGKEY = 'RT-';
private const testing = ['test','testing'];
public static function handle(Message $msg): bool
{
if (! self::canProcess($msg->echoarea)
|| (strtolower($msg->user_to) !== 'all')
|| (! in_array(strtolower($msg->subject),self::testing)))
return FALSE;
Log::info(sprintf('%s:- Processing TEST message from (%s) [%s] in [%s]',self::LOGKEY,$msg->user_from,$msg->fftn,$msg->echoarea));
Notification::route('echomail',$msg->echoarea)->notify(new TestNotification($msg));
return TRUE;
}
}