Skip to content

Commit

Permalink
Remove backslash before native functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer committed Jan 23, 2015
1 parent 9a3c76b commit 924497d
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 31 deletions.
14 changes: 7 additions & 7 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getMailbox($name)
throw new MailboxDoesNotExistException($name);
}

return new Mailbox($this->server . \imap_utf7_encode($name), $this);
return new Mailbox($this->server . imap_utf7_encode($name), $this);
}

/**
Expand All @@ -73,7 +73,7 @@ public function getMailbox($name)
*/
public function count()
{
return \imap_num_msg($this->resource);
return imap_num_msg($this->resource);
}

/**
Expand All @@ -86,7 +86,7 @@ public function count()
*/
public function createMailbox($name)
{
if (\imap_createmailbox($this->resource, $this->server . $name)) {
if (imap_createmailbox($this->resource, $this->server . $name)) {
$this->mailboxNames = $this->mailboxes = null;

return $this->getMailbox($name);
Expand All @@ -104,12 +104,12 @@ public function createMailbox($name)
*/
public function close($flag = 0)
{
return \imap_close($this->resource, $flag);
return imap_close($this->resource, $flag);
}

public function deleteMailbox(Mailbox $mailbox)
{
if (false === \imap_deletemailbox(
if (false === imap_deletemailbox(
$this->resource,
$this->server . $mailbox->getName()
)) {
Expand Down Expand Up @@ -137,9 +137,9 @@ public function getResource()
private function getMailboxNames()
{
if (null === $this->mailboxNames) {
$mailboxes = \imap_getmailboxes($this->resource, $this->server, '*');
$mailboxes = imap_getmailboxes($this->resource, $this->server, '*');
foreach ($mailboxes as $mailbox) {
$this->mailboxNames[] = \imap_utf7_decode(str_replace($this->server, '', $mailbox->name));
$this->mailboxNames[] = imap_utf7_decode(str_replace($this->server, '', $mailbox->name));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Exception extends \RuntimeException
public function __construct($message, $code = null, $previous = null)
{
parent::__construct($message, $code, $previous);
$this->errors = \imap_errors();
$this->errors = imap_errors();
}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function count()
{
$this->init();

return \imap_num_msg($this->connection->getResource());
return imap_num_msg($this->connection->getResource());
}

/**
Expand All @@ -59,9 +59,9 @@ public function getMessages(SearchExpression $search = null)

$query = ($search ? (string) $search : 'ALL');

$messageNumbers = \imap_search($this->connection->getResource(), $query, \SE_UID);
$messageNumbers = imap_search($this->connection->getResource(), $query, \SE_UID);
if (false == $messageNumbers) {
// \imap_search can also return false
// imap_search can also return false
$messageNumbers = array();
}

Expand Down Expand Up @@ -112,7 +112,7 @@ public function expunge()
{
$this->init();

\imap_expunge($this->connection->getResource());
imap_expunge($this->connection->getResource());

return $this;
}
Expand All @@ -126,17 +126,17 @@ public function expunge()
*/
public function addMessage($message)
{
return \imap_append($this->connection->getResource(), $this->mailbox, $message);
return imap_append($this->connection->getResource(), $this->mailbox, $message);
}

/**
* If connection is not currently in this mailbox, switch it to this mailbox
*/
private function init()
{
$check = \imap_check($this->connection->getResource());
$check = imap_check($this->connection->getResource());
if ($check->Mailbox != $this->mailbox) {
\imap_reopen($this->connection->getResource(), $this->mailbox);
imap_reopen($this->connection->getResource(), $this->mailbox);
}
}
}
12 changes: 6 additions & 6 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ public function getSubject()
public function getHeaders()
{
if (null === $this->headers) {
// \imap_header is much faster than \imap_fetchheader
// \imap_header returns only a subset of all mail headers,
// imap_header is much faster than imap_fetchheader
// imap_header returns only a subset of all mail headers,
// but it does include the message flags.
$headers = \imap_header($this->stream, \imap_msgno($this->stream, $this->messageNumber));
$headers = imap_header($this->stream, imap_msgno($this->stream, $this->messageNumber));
$this->headers = new Message\Headers($headers);
}

Expand Down Expand Up @@ -255,7 +255,7 @@ public function delete()
// 'deleted' header changed, force to reload headers, would be better to set deleted flag to true on header
$this->headers = null;

if (!\imap_delete($this->stream, $this->messageNumber, \FT_UID)) {
if (!imap_delete($this->stream, $this->messageNumber, \FT_UID)) {
throw new MessageDeleteException($this->messageNumber);
}
}
Expand All @@ -269,7 +269,7 @@ public function delete()
*/
public function move(Mailbox $mailbox)
{
if (!\imap_mail_move($this->stream, $this->messageNumber, $mailbox->getName(), \CP_UID)) {
if (!imap_mail_move($this->stream, $this->messageNumber, $mailbox->getName(), \CP_UID)) {
throw new MessageMoveException($this->messageNumber, $mailbox->getName());
}

Expand Down Expand Up @@ -297,7 +297,7 @@ public function keepUnseen($bool = true)
*/
private function loadStructure()
{
$structure = \imap_fetchstructure($this->stream, $this->messageNumber, \FT_UID);
$structure = imap_fetchstructure($this->stream, $this->messageNumber, \FT_UID);
$this->parseStructure($structure);
}
}
7 changes: 0 additions & 7 deletions src/Message/EmailAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,4 @@ public function __toString()
{
return $this->getAddress();
}

public static function fromString($address)
{
$parts = explode('@', $address);

return new self($parts[0], $parts[1]);
}
}
2 changes: 1 addition & 1 deletion src/Message/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public function getDisposition()
*/
protected function doGetContent($keepUnseen = false)
{
return \imap_fetchbody(
return imap_fetchbody(
$this->stream,
$this->messageNumber,
$this->partNumber ?: 1,
Expand Down
4 changes: 2 additions & 2 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(
$flags = '/imap/ssl/validate-cert',
$parameters = array()
) {
if (!function_exists('\imap_open')) {
if (!function_exists('imap_open')) {
throw new \RuntimeException('IMAP extension must be enabled');
}

Expand All @@ -70,7 +70,7 @@ public function __construct(
*/
public function authenticate($username, $password)
{
$resource = @\imap_open(
$resource = @imap_open(
$this->getServerString(),
$username,
$password,
Expand Down

0 comments on commit 924497d

Please sign in to comment.