Update objects to use __toString()
This commit is contained in:
@@ -16,11 +16,11 @@ class UserIDPacket extends Packet
|
||||
function __construct($name='',$comment='',$email='')
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
if (! $comment && ! $email) {
|
||||
$this->input = $name;
|
||||
$this->read();
|
||||
|
||||
|
||||
} else {
|
||||
$this->name = $name;
|
||||
$this->comment = $comment;
|
||||
@@ -28,7 +28,7 @@ class UserIDPacket extends Packet
|
||||
}
|
||||
}
|
||||
|
||||
function __toString()
|
||||
public function display()
|
||||
{
|
||||
$text = [];
|
||||
|
||||
@@ -41,7 +41,7 @@ class UserIDPacket extends Packet
|
||||
|
||||
function body()
|
||||
{
|
||||
return ''.$this; // Convert to string is the body
|
||||
return ''.$this->display(); // Convert to string is the body
|
||||
}
|
||||
|
||||
function read()
|
||||
@@ -53,21 +53,21 @@ class UserIDPacket extends Packet
|
||||
$this->comment = trim($matches[2]);
|
||||
$this->email = trim($matches[3]);
|
||||
}
|
||||
|
||||
|
||||
// User IDs of the form: "name <email>"
|
||||
else if (preg_match('/^([^<]+)\s+<([^>]+)>$/', $this->data, $matches)) {
|
||||
$this->name = trim($matches[1]);
|
||||
$this->comment = NULL;
|
||||
$this->email = trim($matches[2]);
|
||||
}
|
||||
|
||||
|
||||
// User IDs of the form: "name"
|
||||
else if (preg_match('/^([^<]+)$/', $this->data, $matches)) {
|
||||
$this->name = trim($matches[1]);
|
||||
$this->comment = NULL;
|
||||
$this->email = NULL;
|
||||
}
|
||||
|
||||
|
||||
// User IDs of the form: "<email>"
|
||||
else if (preg_match('/^<([^>]+)>$/', $this->data, $matches)) {
|
||||
$this->name = NULL;
|
||||
|
Reference in New Issue
Block a user