Move to more PSR-4 standards.
This commit is contained in:
32
lib/OpenPgP/ModificationDetectionCodePacket.php
Normal file
32
lib/OpenPgP/ModificationDetectionCodePacket.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Leenooks\OpenPGP;
|
||||
|
||||
/**
|
||||
* OpenPGP Modification Detection Code packet (tag 19).
|
||||
*
|
||||
* @see http://tools.ietf.org/html/rfc4880#section-5.14
|
||||
*/
|
||||
class ModificationDetectionCodePacket extends Packet
|
||||
{
|
||||
protected $tag = 19;
|
||||
|
||||
function header_and_body(): array
|
||||
{
|
||||
// Get body first, we will need it's length
|
||||
$body = $this->body();
|
||||
|
||||
if (strlen($body) != 20)
|
||||
throw new Exception("Bad ModificationDetectionCodePacket");
|
||||
|
||||
return ['header'=>"\xD3\x14",'body'=>$body];
|
||||
}
|
||||
|
||||
function read()
|
||||
{
|
||||
$this->data = $this->input;
|
||||
|
||||
if (strlen($this->input) != 20)
|
||||
throw new Exception("Bad ModificationDetectionCodePacket");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user