More complete rework of packet parsing and packet generation with 29710c

This commit is contained in:
2024-05-19 23:28:45 +10:00
parent 46f52dd56d
commit f279d85b08
43 changed files with 412 additions and 291 deletions

View File

@@ -70,26 +70,38 @@ trait MessageAttributes
public function getOriginAttribute(string $val=NULL): ?string
{
if ($this->exists && (! $val))
return $val;
// If $val is not set, then it may be an unsaved object
return ((! $this->exists) && $this->set->has('set_origin'))
? sprintf(' * Origin: %s',$this->set->get('set_origin'))
: $val;
return sprintf(' * Origin: %s',
((! $this->exists) && $this->set->has('set_origin'))
? $this->set->get('set_origin')
: $val);
}
public function getTaglineAttribute(string $val=NULL): ?string
{
if ($this->exists && (! $val))
return $val;
// If $val is not set, then it may be an unsaved object
return ((! $this->exists) && $this->set->has('set_tagline'))
? sprintf('... %s',$this->set->get('set_tagline'))
: $val;
return sprintf('... %s',
((! $this->exists) && $this->set->has('set_tagline'))
? $this->set->get('set_tagline')
: $val);
}
public function getTearlineAttribute(string $val=NULL): ?string
{
if ($this->exists && (! $val))
return $val;
// If $val is not set, then it may be an unsaved object
return ((! $this->exists) && $this->set->has('set_tearline'))
? sprintf('--- %s',$this->set->get('set_tearline'))
: $val;
return sprintf('--- %s',
((! $this->exists) && $this->set->has('set_tearline'))
? $this->set->get('set_tearline')
: $val);
}
/* METHODS */
@@ -141,10 +153,11 @@ trait MessageAttributes
'receipt' => $this->isFlagSet(Message::FLAG_ISRETRECEIPT),
'audit' => $this->isFlagSet(Message::FLAG_AUDITREQ),
'fileupdate' => $this->isFlagSet(Message::FLAG_FILEUPDATEREQ),
'pktpasswd' => $this->isFlagSet(Message::FLAG_PKTPASSWD),
])->filter();
}
private function isFlagSet($flag): bool
public function isFlagSet($flag): bool
{
return ($this->flags & $flag);
}