Sending Mail now dynamically creates packet name, size and mtime
This commit is contained in:
@@ -18,9 +18,6 @@ class Mail extends Item
|
||||
switch ($action) {
|
||||
case self::I_SEND:
|
||||
$this->file = $mail;
|
||||
$this->file_name = sprintf('%s.pkt',$mail->name);
|
||||
$this->file_size = strlen($mail);
|
||||
$this->file_mtime = Carbon::now()->timestamp; // @todo This timestamp should be consistent incase of retries
|
||||
|
||||
break;
|
||||
|
||||
@@ -31,8 +28,21 @@ class Mail extends Item
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function __get($key) {
|
||||
switch ($key) {
|
||||
case 'file': return $this->file;
|
||||
default:
|
||||
return parent::__get($key);
|
||||
}
|
||||
}
|
||||
|
||||
public function read(int $start,int $length): string
|
||||
{
|
||||
return substr((string)$this->file,$start,$length);
|
||||
}
|
||||
|
||||
public function youngest(): Carbon
|
||||
{
|
||||
return $this->file->messages->pluck('date')->sort()->last();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user