Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'cs/part2-variable-renaming' of https://github.com/arse/zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
30 changes: 15 additions & 15 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
class Message
{

protected $_parts = array();
protected $_mime = null;
protected $parts = array();
protected $mime = null;

/**
* Returns the list of all Zend_Mime_Parts in the message
Expand All @@ -27,7 +27,7 @@ class Message
*/
public function getParts()
{
return $this->_parts;
return $this->parts;
}

/**
Expand All @@ -37,7 +37,7 @@ public function getParts()
*/
public function setParts($parts)
{
$this->_parts = $parts;
$this->parts = $parts;
}

/**
Expand All @@ -50,7 +50,7 @@ public function addPart(Part $part)
/**
* @todo check for duplicate object handle
*/
$this->_parts[] = $part;
$this->parts[] = $part;
}

/**
Expand All @@ -61,7 +61,7 @@ public function addPart(Part $part)
*/
public function isMultiPart()
{
return (count($this->_parts) > 1);
return (count($this->parts) > 1);
}

/**
Expand All @@ -74,7 +74,7 @@ public function isMultiPart()
*/
public function setMime(Mime $mime)
{
$this->_mime = $mime;
$this->mime = $mime;
}

/**
Expand All @@ -87,11 +87,11 @@ public function setMime(Mime $mime)
*/
public function getMime()
{
if ($this->_mime === null) {
$this->_mime = new Mime();
if ($this->mime === null) {
$this->mime = new Mime();
}

return $this->_mime;
return $this->mime;
}

/**
Expand All @@ -112,7 +112,7 @@ public function getMime()
public function generateMessage($EOL = Mime::LINEEND)
{
if (! $this->isMultiPart()) {
$body = array_shift($this->_parts);
$body = array_shift($this->parts);
$body = $body->getContent($EOL);
} else {
$mime = $this->getMime();
Expand All @@ -121,7 +121,7 @@ public function generateMessage($EOL = Mime::LINEEND)
$body = 'This is a message in Mime Format. If you see this, '
. "your mail reader does not support this format." . $EOL;

foreach (array_keys($this->_parts) as $p) {
foreach (array_keys($this->parts) as $p) {
$body .= $boundaryLine
. $this->getPartHeaders($p, $EOL)
. $EOL
Expand All @@ -142,7 +142,7 @@ public function generateMessage($EOL = Mime::LINEEND)
*/
public function getPartHeadersArray($partnum)
{
return $this->_parts[$partnum]->getHeadersArray();
return $this->parts[$partnum]->getHeadersArray();
}

/**
Expand All @@ -153,7 +153,7 @@ public function getPartHeadersArray($partnum)
*/
public function getPartHeaders($partnum, $EOL = Mime::LINEEND)
{
return $this->_parts[$partnum]->getHeaders($EOL);
return $this->parts[$partnum]->getHeaders($EOL);
}

/**
Expand All @@ -164,7 +164,7 @@ public function getPartHeaders($partnum, $EOL = Mime::LINEEND)
*/
public function getPartContent($partnum, $EOL = Mime::LINEEND)
{
return $this->_parts[$partnum]->getContent($EOL);
return $this->parts[$partnum]->getContent($EOL);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/Mime.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Mime
const MULTIPART_MIXED = 'multipart/mixed';
const MULTIPART_RELATED = 'multipart/related';

protected $_boundary;
protected $boundary;
protected static $makeUnique = 0;

// lookup-Tables for QuotedPrintable
Expand Down Expand Up @@ -286,9 +286,9 @@ public function __construct($boundary = null)
{
// This string needs to be somewhat unique
if ($boundary === null) {
$this->_boundary = '=_' . md5(microtime(1) . self::$makeUnique++);
$this->boundary = '=_' . md5(microtime(1) . self::$makeUnique++);
} else {
$this->_boundary = $boundary;
$this->boundary = $boundary;
}
}

Expand Down Expand Up @@ -325,7 +325,7 @@ public static function encode($str, $encoding, $EOL = self::LINEEND)
*/
public function boundary()
{
return $this->_boundary;
return $this->boundary;
}

/**
Expand All @@ -337,7 +337,7 @@ public function boundary()
*/
public function boundaryLine($EOL = self::LINEEND)
{
return $EOL . '--' . $this->_boundary . $EOL;
return $EOL . '--' . $this->boundary . $EOL;
}

/**
Expand All @@ -348,6 +348,6 @@ public function boundaryLine($EOL = self::LINEEND)
*/
public function mimeEnd($EOL = self::LINEEND)
{
return $EOL . '--' . $this->_boundary . '--' . $EOL;
return $EOL . '--' . $this->boundary . '--' . $EOL;
}
}
28 changes: 14 additions & 14 deletions src/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class Part
public $boundary;
public $location;
public $language;
protected $_content;
protected $_isStream = false;
protected $content;
protected $isStream = false;


/**
Expand All @@ -41,9 +41,9 @@ class Part
*/
public function __construct($content)
{
$this->_content = $content;
$this->content = $content;
if (is_resource($content)) {
$this->_isStream = true;
$this->isStream = true;
}
}

Expand All @@ -63,7 +63,7 @@ public function __construct($content)
*/
public function isStream()
{
return $this->_isStream;
return $this->isStream;
}

/**
Expand All @@ -75,15 +75,15 @@ public function isStream()
*/
public function getEncodedStream()
{
if (!$this->_isStream) {
if (!$this->isStream) {
throw new Exception\RuntimeException('Attempt to get a stream from a string part');
}

//stream_filter_remove(); // ??? is that right?
switch ($this->encoding) {
case Mime::ENCODING_QUOTEDPRINTABLE:
$filter = stream_filter_append(
$this->_content,
$this->content,
'convert.quoted-printable-encode',
STREAM_FILTER_READ,
array(
Expand All @@ -97,7 +97,7 @@ public function getEncodedStream()
break;
case Mime::ENCODING_BASE64:
$filter = stream_filter_append(
$this->_content,
$this->content,
'convert.base64-encode',
STREAM_FILTER_READ,
array(
Expand All @@ -111,7 +111,7 @@ public function getEncodedStream()
break;
default:
}
return $this->_content;
return $this->content;
}

/**
Expand All @@ -121,10 +121,10 @@ public function getEncodedStream()
*/
public function getContent($EOL = Mime::LINEEND)
{
if ($this->_isStream) {
if ($this->isStream) {
return stream_get_contents($this->getEncodedStream());
} else {
return Mime::encode($this->_content, $this->encoding, $EOL);
return Mime::encode($this->content, $this->encoding, $EOL);
}
}

Expand All @@ -134,10 +134,10 @@ public function getContent($EOL = Mime::LINEEND)
*/
public function getRawContent()
{
if ($this->_isStream) {
return stream_get_contents($this->_content);
if ($this->isStream) {
return stream_get_contents($this->content);
} else {
return $this->_content;
return $this->content;
}
}

Expand Down

0 comments on commit 92203eb

Please sign in to comment.