2024-10-31 12:53:43 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Classes\FTN\Process\Netmail\Robot\Areafix;
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
use Illuminate\Support\Facades\Notification;
|
|
|
|
|
2024-11-26 01:23:07 +00:00
|
|
|
use App\Classes\FTN\Process\Netmail\Robot\Areafix;
|
2024-10-31 12:53:43 +00:00
|
|
|
use App\Notifications\Netmails\Areafix\Help as HelpNotification;
|
|
|
|
|
|
|
|
// A Help Index Command
|
|
|
|
class Help extends Base
|
|
|
|
{
|
|
|
|
private const LOGKEY = 'AFH';
|
|
|
|
private const areafix_classes = 'app/Classes/FTN/Process/Netmail/Robot/Areafix';
|
|
|
|
private const command = '%HELP';
|
|
|
|
|
|
|
|
public static function help(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
self::command,
|
|
|
|
' This message!',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function process(): string
|
|
|
|
{
|
|
|
|
Log::debug(sprintf('%s:- Processing [%s] for [%s]',self::LOGKEY,self::command,$this->mo->fftn->ftn));
|
|
|
|
|
|
|
|
$result = collect();
|
|
|
|
|
|
|
|
foreach (preg_grep('/^([^.])/',scandir(self::areafix_classes)) as $file) {
|
2024-10-31 23:04:12 +00:00
|
|
|
if (($file === 'Base.php') || (! str_ends_with(strtolower($file),'.php')))
|
2024-10-31 12:53:43 +00:00
|
|
|
continue;
|
|
|
|
|
2024-11-26 01:23:07 +00:00
|
|
|
$class = Areafix::commands.preg_replace('/\.php$/','',$file);
|
2024-10-31 23:04:12 +00:00
|
|
|
if ($result->count())
|
|
|
|
$result->push('');
|
|
|
|
|
|
|
|
$result = $result
|
|
|
|
->merge($class::help());
|
2024-10-31 12:53:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Notification::route('netmail',$this->mo->fftn)->notify(new HelpNotification($this->mo,$result));
|
|
|
|
|
|
|
|
return sprintf('%-25s <-- COMMAND PROCESSED',self::command);
|
|
|
|
}
|
|
|
|
}
|