Update objects to use __toString()
This commit is contained in:
@@ -11,12 +11,14 @@ class EmbeddedSignaturePacket extends SignaturePacket
|
||||
{
|
||||
protected $tag = 32;
|
||||
|
||||
function header_and_body(): array
|
||||
protected function header_and_body(): array
|
||||
{
|
||||
$body = $this->body(); // Get body first, we will need it's length
|
||||
$size = chr(255).pack('N',strlen($body)+1); // Use 5-octet lengths + 1 for tag as first packet body octet
|
||||
$tag = chr($this->tag);
|
||||
return ['header'=>$this->size().chr($this->tag),'body'=>$this->body()];
|
||||
}
|
||||
|
||||
return ['header'=>$size.$tag,'body'=>$body];
|
||||
protected function size(): string
|
||||
{
|
||||
// Use 5-octet lengths + 1 for tag as first packet body octet
|
||||
return chr(255).pack('N',strlen($this->body())+1);
|
||||
}
|
||||
}
|
@@ -9,11 +9,6 @@ class PolicyURIPacket extends Subpacket
|
||||
{
|
||||
protected $tag = 26;
|
||||
|
||||
function body()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function read()
|
||||
{
|
||||
$this->data = $this->input;
|
||||
|
@@ -9,11 +9,6 @@ class PreferredKeyServerPacket extends Subpacket
|
||||
{
|
||||
protected $tag = 24;
|
||||
|
||||
function body()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function read()
|
||||
{
|
||||
$this->data = $this->input;
|
||||
|
@@ -9,11 +9,6 @@ class SignersUserIDPacket extends Subpacket
|
||||
{
|
||||
protected $tag = 28;
|
||||
|
||||
function body()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function read()
|
||||
{
|
||||
$this->data = $this->input;
|
||||
|
@@ -9,18 +9,9 @@ class Subpacket extends Packet
|
||||
{
|
||||
protected $tag = NULL;
|
||||
|
||||
function body()
|
||||
protected function header_and_body(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function header_and_body(): array
|
||||
{
|
||||
$body = $this->body(); // Get body first, we will need it's length
|
||||
$size = chr(255).pack('N',strlen($body)+1); // Use 5-octet lengths + 1 for tag as first packet body octet
|
||||
$tag = chr($this->tag);
|
||||
|
||||
return ['header'=>$size.$tag,'body'=>$body];
|
||||
return ['header'=>$this->size().chr($this->tag),'body'=>$this->body()];
|
||||
}
|
||||
|
||||
/* Defaults for unsupported packets */
|
||||
@@ -36,4 +27,10 @@ class Subpacket extends Packet
|
||||
|
||||
$this->tag = $tag;
|
||||
}
|
||||
|
||||
protected function size(): string
|
||||
{
|
||||
// Use 5-octet lengths + 1 for tag as first packet body octet
|
||||
return chr(255).pack('N',strlen($this->body())+1);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user