Code cleanup, no functional changes

This commit is contained in:
2023-06-27 19:39:11 +12:00
parent b70a36003a
commit ad36da0bb1
64 changed files with 466 additions and 438 deletions

View File

@@ -2,7 +2,6 @@
namespace App\Classes;
use Exception;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
@@ -93,13 +92,13 @@ abstract class Protocol
public function __construct(Setup $o=NULL)
{
if ($o && ! $o->system->addresses->count())
throw new Exception('We dont have any FTN addresses assigned');
throw new \Exception('We dont have any FTN addresses assigned');
$this->setup = $o;
}
/**
* @throws Exception
* @throws \Exception
*/
public function __get($key)
{
@@ -113,12 +112,12 @@ abstract class Protocol
return $this->comms[$key] ?? '';
default:
throw new Exception('Unknown key: '.$key);
throw new \Exception('Unknown key: '.$key);
}
}
/**
* @throws Exception
* @throws \Exception
*/
public function __set($key,$value)
{
@@ -131,14 +130,14 @@ abstract class Protocol
break;
default:
throw new Exception('Unknown key: '.$key);
throw new \Exception('Unknown key: '.$key);
}
}
/**
* We got an error, close anything we are have open
*
* @throws Exception
* @throws \Exception
*/
protected function error_close(): void
{
@@ -160,7 +159,7 @@ abstract class Protocol
{
$pid = pcntl_fork();
if ($pid == -1)
if ($pid === -1)
throw new SocketException(SocketException::CANT_ACCEPT,'Could not fork process');
Log::debug(sprintf('%s:= End [%d]',self::LOGKEY,$pid));
@@ -216,7 +215,7 @@ abstract class Protocol
* @param SocketClient $client
* @param Address|null $o
* @return int
* @throws Exception
* @throws \Exception
*/
public function session(int $type,SocketClient $client,Address $o=NULL): int
{
@@ -311,7 +310,7 @@ abstract class Protocol
$this->node->session_time%60,
$this->send->total_sent,$this->send->total_sent_bytes,'b',
$this->recv->total_recv,$this->recv->total_recv_bytes,'b',
(($rc & self::S_MASK) == self::S_OK) ? 'Successful' : 'Failed',
(($rc & self::S_MASK) === self::S_OK) ? 'Successful' : 'Failed',
));
// Add unknown FTNs to the DB