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

@@ -190,7 +190,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
// Site address, password and compatibility
$makedata .= sprintf('{EMSI}{%s}{%s}{%s}{%s}',
$this->our_addresses()->pluck('ftn')->join(' '),
($this->node->password == '-') ? '' : $this->node->password,
($this->node->password === '-') ? '' : $this->node->password,
join(',',$link_codes),
join(',',$compat_codes),
);
@@ -528,7 +528,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
if (++$tries > 6)
return self::TIMEOUT;
if ($mode == self::SM_INBOUND) {
if ($mode === self::SM_INBOUND) {
$this->client->buffer_add(self::EMSI_REQ.self::CR);
} elseif ($tries > 1) {
@@ -585,17 +585,17 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
if ($this->client->timer_expired($t1))
break;
if ($ch == self::TIMEOUT)
if ($ch === self::TIMEOUT)
continue;
if (! $got) {
if ($ch == ord('*'))
if ($ch === ord('*'))
$got = 1;
else
continue;
}
if (($ch == ord(self::CR)) || ($ch == ord(self::NL))) {
if (($ch === ord(self::CR)) || ($ch === ord(self::NL))) {
if (! strncmp($p,self::EMSI_HBT,self::EMSI_SEQ_LEN)) {
Log::debug(sprintf('%s: - Received EMSI_HBT',self::LOGKEY));
@@ -740,12 +740,12 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
if ($this->client->timer_expired($t1))
return self::TIMEOUT;
if ($ch == self::TIMEOUT)
if ($ch === self::TIMEOUT)
continue;
$ch &= 0x7f;
if (($ch == ord(self::CR)) || ($ch == ord(self::NL))) {
if (($ch === ord(self::CR)) || ($ch === ord(self::NL))) {
if (! $p)
continue;
@@ -844,7 +844,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
return self::TIMEOUT;
if ($this->client->timer_expired($t2)) {
if ($this->setup->do_prevent && $tries == 0) {
if ($this->setup->do_prevent && $tries === 0) {
$this->setup->do_prevent = 0;
$this->client->buffer_add(self::EMSI_INQ.self::CR);
@@ -862,12 +862,12 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
continue;
}
if ($ch == self::TIMEOUT)
if ($ch === self::TIMEOUT)
continue;
$ch &= 0x7f;
if (($ch == ord(self::CR)) || ($ch == ord(self::NL))) {
if (($ch === ord(self::CR)) || ($ch === ord(self::NL))) {
if (strstr($p,self::EMSI_REQ)) {
Log::info(sprintf('%s: - Got EMSI_REQ',self::LOGKEY));
if ($gotreq++)
@@ -909,7 +909,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
if ($this->client->timer_expired($t1))
return self::TIMEOUT;
if (($ch == self::TIMEOUT) || $this->client->timer_expired($t2)) {
if (($ch === self::TIMEOUT) || $this->client->timer_expired($t2)) {
if (! $got) {
$this->emsi_banner();
$t2 = $this->client->timer_set(self::EMSI_RESEND_TO);
@@ -923,10 +923,10 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
$ch &= 0x7f;
if ((! $got) && ($ch == ord('*')))
if ((! $got) && ($ch === ord('*')))
$got = 1;
if ($got && (($ch == ord(self::CR)) || ($ch == ord(self::NL)))) {
if ($got && (($ch === ord(self::CR)) || ($ch === ord(self::NL)))) {
$got = 0;
if (strstr($p, self::EMSI_INQ)) {
@@ -992,7 +992,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
if ($this->node->aka_authed) {
$xproto = $this->is_freq_available();
if ($xproto == self::FR_NOTHANDLED || $xproto == self::FR_NOTAVAILABLE)
if ($xproto === self::FR_NOTHANDLED || $xproto === self::FR_NOTAVAILABLE)
$this->node->optionSet(self::O_HRQ);
}
@@ -1064,7 +1064,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
}
$xproto = ($this->optionGet(self::O_RH1) && ($this->node->optionGet(self::O_RH1)));
$x = (substr($t,1,1) == 'H' && $xproto ) ? 'x' : '';
$x = (substr($t,1,1) === 'H' && $xproto ) ? 'x' : '';
Log::info(sprintf('%s: = Using [%s]',self::LOGKEY,$t));
@@ -1166,7 +1166,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
// @todo If the node is not defined in the DB node->address is NULL. Need to figure out how to handle those nodes.
$rc = (new Zmodem)->zmodem_receive($this->client,$zap,$this->recv,$this->node->address);
return ($rc == self::RCDO || $rc == self::ERROR);
return ($rc === self::RCDO || $rc === self::ERROR);
}
/**