Skip to content

Commit

Permalink
implement bapcltd#1
Browse files Browse the repository at this point in the history
  • Loading branch information
bapcltd-marv committed Jan 29, 2020
1 parent 2edb766 commit dab9937
Show file tree
Hide file tree
Showing 5 changed files with 1,387 additions and 192 deletions.
20 changes: 9 additions & 11 deletions src/PhpImap/DataPartInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DataPartInfo
const TEXT_HTML = 1;

/**
* @var string|int
* @var int
*
* @readonly
*/
Expand All @@ -30,7 +30,7 @@ class DataPartInfo
public $charset;

/**
* @var string|int
* @var 0|string
*
* @readonly
*/
Expand All @@ -54,10 +54,10 @@ class DataPartInfo
private $data;

/**
* @param string|int $id
* @param string|int $part
* @param int|mixed $encoding
* @param int $options
* @param int $id
* @param 0|string $part
* @param int|mixed $encoding
* @param int $options
*/
public function __construct(Mailbox $mail, $id, $part, $encoding, $options)
{
Expand All @@ -73,12 +73,10 @@ public function __construct(Mailbox $mail, $id, $part, $encoding, $options)
*/
public function fetch()
{
if (0 == $this->part) {
/** @var string */
$this->data = $this->mail->imap('body', [$this->id, $this->options]);
if (0 === $this->part) {
$this->data = Imap::body($this->mail->getImapStream(), $this->id, $this->options);
} else {
/** @var string */
$this->data = $this->mail->imap('fetchbody', [$this->id, $this->part, $this->options]);
$this->data = Imap::fetchbody($this->mail->getImapStream(), $this->id, $this->part, $this->options);
}

switch ($this->encoding) {
Expand Down
Loading

0 comments on commit dab9937

Please sign in to comment.