From 8c1c02a22fc4c4e0756e9b733302bd923355aa69 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Thu, 8 May 2014 21:43:06 +0100 Subject: [PATCH] Fixing PHPCS and PHPMD errors --- PHPCI/Controller/SessionController.php | 12 +++++------ PHPCI/Helper/Email.php | 28 +++++++++++++------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/PHPCI/Controller/SessionController.php b/PHPCI/Controller/SessionController.php index 2c4712ab..def6d4c4 100644 --- a/PHPCI/Controller/SessionController.php +++ b/PHPCI/Controller/SessionController.php @@ -104,14 +104,14 @@ class SessionController extends \PHPCI\Controller $key = md5(date('Y-m-d') . $user->getHash()); $url = PHPCI_URL; $name = $user->getName(); - $id = $user->getId(); + $userId = $user->getId(); $message = <<setTo($user->getEmail(), $user->getName()); + $email->setEmailTo($user->getEmail(), $user->getName()); $email->setSubject('Password reset'); $email->setBody($message); $email->send(); @@ -133,9 +133,9 @@ MSG; return $this->view->render(); } - public function resetPassword($id, $key) + public function resetPassword($userId, $key) { - $user = $this->userStore->getById($id); + $user = $this->userStore->getById($userId); $userKey = md5(date('Y-m-d') . $user->getHash()); if (empty($user) || $key != $userKey) { @@ -154,7 +154,7 @@ MSG; die; } - $this->view->id = $id; + $this->view->id = $userId; $this->view->key = $key; return $this->view->render(); diff --git a/PHPCI/Helper/Email.php b/PHPCI/Helper/Email.php index 32cbe4f4..3ab57b95 100644 --- a/PHPCI/Helper/Email.php +++ b/PHPCI/Helper/Email.php @@ -9,8 +9,8 @@ class Email { const DEFAULT_FROM = 'PHPCI '; - protected $to = array(); - protected $cc = array(); + protected $emailTo = array(); + protected $emailCc = array(); protected $subject = 'Email from PHPCI'; protected $body = ''; protected $isHtml = false; @@ -21,16 +21,16 @@ class Email $this->config = Config::getInstance(); } - public function setTo($email, $name = null) + public function setEmailTo($email, $name = null) { - $this->to[$email] = $name; + $this->emailTo[$email] = $name; return $this; } public function addCc($email, $name = null) { - $this->cc[$email] = $name; + $this->emailCc[$email] = $name; return $this; } @@ -77,20 +77,20 @@ class Email $headers .= 'From: ' . $this->getFrom() . PHP_EOL; - $to = array(); - foreach ($this->to as $email => $name) { + $emailTo = array(); + foreach ($this->emailTo as $email => $name) { $thisTo = $email; if (!is_null($name)) { $thisTo = '"' . $name . '" <' . $thisTo . '>'; } - $to[] = $thisTo; + $emailTo[] = $thisTo; } - $to = implode(', ', $to); + $emailTo = implode(', ', $emailTo); - return mail($to, $this->subject, $this->body, $headers); + return mail($emailTo, $this->subject, $this->body, $headers); } protected function sendViaSwiftMailer() @@ -100,15 +100,15 @@ class Email $message = \Swift_Message::newInstance($this->subject) ->setFrom($this->getFrom()) - ->setTo($this->to) + ->setTo($this->emailTo) ->setBody($this->body); if ($this->isHtml) { $message->setContentType('text/html'); } - if (is_array($this->cc) && count($this->cc)) { - $message->setCc($this->cc); + if (is_array($this->emailCc) && count($this->emailCc)) { + $message->setCc($this->emailCc); } return $mailer->send($message); @@ -124,4 +124,4 @@ class Email return $email; } -} \ No newline at end of file +}