Update objects to use __toString()
This commit is contained in:
@@ -48,6 +48,17 @@ class Message implements \IteratorAggregate,\ArrayAccess
|
||||
$this->packets = $packets;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$result = '';
|
||||
|
||||
foreach ($this as $p) {
|
||||
$result .= (string)$p;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see http://tools.ietf.org/html/rfc4880#section-4.1
|
||||
* @see http://tools.ietf.org/html/rfc4880#section-4.2
|
||||
@@ -192,7 +203,7 @@ class Message implements \IteratorAggregate,\ArrayAccess
|
||||
$bytes = '';
|
||||
|
||||
foreach ($this as $p) {
|
||||
$bytes .= $p->to_bytes();
|
||||
$bytes .= (string)$p;
|
||||
}
|
||||
|
||||
return $bytes;
|
||||
|
Reference in New Issue
Block a user