diff --git a/.gitignore b/.gitignore
index 88d29224..989164d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ docs/phpdoc/
test/message.txt
test/testbootstrap.php
.idea
+build/
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
new file mode 100644
index 00000000..afdb8844
--- /dev/null
+++ b/.scrutinizer.yml
@@ -0,0 +1,126 @@
+before_commands:
+ - "composer install --prefer-source"
+
+tools:
+ # Code Coverage
+ external_code_coverage:
+ enabled: true
+ timeout: 300
+ filter:
+ excluded_paths:
+ - 'docs/*'
+ - 'examples/*'
+ - 'extras/*'
+ - 'test/*'
+ - 'vendor/*'
+
+
+ php_code_coverage:
+ enabled: false
+ test_command: phpunit
+ filter:
+ excluded_paths:
+ - 'docs/*'
+ - 'examples/*'
+ - 'extras/*'
+ - 'test/*'
+ - 'vendor/*'
+
+
+ # Code Sniffer
+ php_code_sniffer:
+ enabled: true
+ command: phpcs
+ config:
+ standard: PSR2
+ filter:
+ excluded_paths:
+ - 'docs/*'
+ - 'examples/*'
+ - 'extras/*'
+ - 'test/*'
+ - 'vendor/*'
+
+
+ # Copy/Paste Detector
+ php_cpd:
+ enabled: true
+ command: phpcpd
+ excluded_dirs:
+ - docs
+ - examples
+ - extras
+ - test
+ - vendor
+
+
+ # PHP CS Fixer (http://http://cs.sensiolabs.org/).
+ php_cs_fixer:
+ enabled: true
+ command: php-cs-fixer
+ config:
+ level: psr2
+ filter:
+ excluded_paths:
+ - 'docs/*'
+ - 'examples/*'
+ - 'extras/*'
+ - 'test/*'
+ - 'vendor/*'
+
+
+ # Analyzes the size and structure of a PHP project.
+ php_loc:
+ enabled: true
+ command: phploc
+ excluded_dirs:
+ - docs
+ - examples
+ - extras
+ - test
+ - vendor
+
+
+ # PHP Mess Detector (http://phpmd.org).
+ php_mess_detector:
+ enabled: true
+ command: phpmd
+ config:
+ rulesets:
+ - codesize
+ - unusedcode
+ - naming
+ - design
+ filter:
+ excluded_paths:
+ - 'docs/*'
+ - 'examples/*'
+ - 'extras/*'
+ - 'test/*'
+ - 'vendor/*'
+
+
+ # Analyzes the size and structure of a PHP project.
+ php_pdepend:
+ enabled: true
+ command: pdepend
+ excluded_dirs:
+ - docs
+ - examples
+ - extras
+ - test
+ - vendor
+
+ # Runs Scrutinizer's PHP Analyzer Tool
+ php_analyzer:
+ enabled: true
+ filter:
+ excluded_paths:
+ - 'docs/*'
+ - 'examples/*'
+ - 'extras/*'
+ - 'test/*'
+ - 'vendor/*'
+
+ # Security Advisory Checker
+ sensiolabs_security_checker: true
diff --git a/.travis.yml b/.travis.yml
index 28f0099f..c51f0f3b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,6 +9,7 @@ before_install:
before_script:
- sudo service postfix stop
- smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
+ - mkdir -p build/logs
- cd test
- cp testbootstrap-dist.php testbootstrap.php
- chmod +x fakesendmail.sh
@@ -16,5 +17,10 @@ before_script:
- sudo cp fakesendmail.sh /var/qmail/bin/sendmail
- sudo cp fakesendmail.sh /usr/sbin/sendmail
- echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' | sudo tee "/home/travis/.phpenv/versions/`php -i|grep "PHP Version"|head -n 1|grep -o -P '\d+\.\d+\.\d+.*'`/etc/conf.d/sendmail.ini"
+ - pwd
+ - ls -al
script:
- - phpunit phpmailerTest
+ - phpunit --configuration ../travis.phpunit.xml.dist
+after_script:
+ - wget https://scrutinizer-ci.com/ocular.phar
+ - php ocular.phar code-coverage:upload --format=php-clover ../build/logs/clover.xml
diff --git a/PHPMailerAutoload.php b/PHPMailerAutoload.php
index be0dad25..6f7dd305 100644
--- a/PHPMailerAutoload.php
+++ b/PHPMailerAutoload.php
@@ -38,7 +38,10 @@ if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
spl_autoload_register('PHPMailerAutoload');
}
} else {
- //Fall back to traditional autoload for old PHP versions
+ /**
+ * Fall back to traditional autoload for old PHP versions
+ * @param string $classname The name of the class to load
+ */
function __autoload($classname)
{
PHPMailerAutoload($classname);
diff --git a/README.md b/README.md
index adfcda4d..8bcd31d8 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
# PHPMailer - A full-featured email creation and transfer class for PHP
Build status: [![Build Status](https://travis-ci.org/Synchro/PHPMailer.png)](https://travis-ci.org/Synchro/PHPMailer)
+[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/Synchro/PHPMailer/badges/quality-score.png?s=320d104c5f7ae0bdb10abd98ea04e0cb107fe905)](https://scrutinizer-ci.com/g/Synchro/PHPMailer/)
+[![Code Coverage](https://scrutinizer-ci.com/g/Synchro/PHPMailer/badges/coverage.png?s=4a55049051633406197503e4f66cc8eeb224c9a4)](https://scrutinizer-ci.com/g/Synchro/PHPMailer/)
## Class Features
diff --git a/class.phpmailer.php b/class.phpmailer.php
index 85fc75eb..f6badc8a 100644
--- a/class.phpmailer.php
+++ b/class.phpmailer.php
@@ -396,11 +396,7 @@ class PHPMailer
* The function that handles the result of the send email action.
* It is called out by send() for each email sent.
*
- * Value can be:
- * - 'function_name' for function names
- * - 'Class::Method' for static method calls
- * - array($object, 'Method') for calling methods on $object
- * See http://php.net/is_callable manual page for more details.
+ * Value can be any php callable: http://www.php.net/is_callable
*
* Parameters:
* bool $result result of the send action
@@ -410,7 +406,6 @@ class PHPMailer
* string $subject the subject
* string $body the email body
* string $from email address of sender
- *
* @type string
*/
public $action_function = '';
diff --git a/docs/generatedocs.sh b/docs/generatedocs.sh
index f4d065f3..8f24269f 100755
--- a/docs/generatedocs.sh
+++ b/docs/generatedocs.sh
@@ -1,5 +1,5 @@
#!/bin/sh
# Regenerate PHPMailer documentation
# Run from within the docs folder
-rm -rf phpdocs/*
-phpdoc --directory .. --target ./phpdoc --ignore test/,examples/,extras/,test_script/ --sourcecode --force --title PHPMailer
+rm -rf phpdoc/*
+phpdoc --directory .. --target ./phpdoc --ignore test/,examples/,extras/,test_script/ --sourcecode --force --title PHPMailer --template="clean"
diff --git a/language/phpmailer.lang-no.php b/language/phpmailer.lang-no.php
index e6975203..db1e327e 100644
--- a/language/phpmailer.lang-no.php
+++ b/language/phpmailer.lang-no.php
@@ -21,4 +21,4 @@ $PHPMAILER_LANG['recipients_failed'] = 'SMTP Feil: Følgende mottagere feilet
$PHPMAILER_LANG['signing'] = 'Signeringsfeil: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() feilet.';
$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfeil: ';
-$PHPMAILER_LANG['variable_set'] = 'Kan ikke sette eller resette variabelen: ';
\ No newline at end of file
+$PHPMAILER_LANG['variable_set'] = 'Kan ikke sette eller resette variabelen: ';
diff --git a/test/bootstrap.php b/test/bootstrap.php
new file mode 100644
index 00000000..056c16d1
--- /dev/null
+++ b/test/bootstrap.php
@@ -0,0 +1,5 @@
+
* @copyright 2004 - 2009 Andy Prevost
+ * @copyright 2010 Marcus Bointon
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
-require 'PHPUnit/Autoload.php';
+require_once 'PHPUnit/Autoload.php';
+require_once '../PHPMailerAutoload.php';
/**
* PHPMailer - PHP email transport unit test class
@@ -21,33 +23,12 @@ require 'PHPUnit/Autoload.php';
class PHPMailerLangTest extends PHPUnit_Framework_TestCase
{
/**
- * Holds the default phpmailer instance.
+ * Holds a phpmailer instance.
* @private
* @var PHPMailer
*/
public $Mail;
- /**
- * Holds the SMTP mail host.
- * @public
- * @var string
- */
- public $Host = "";
-
- /**
- * Holds the change log.
- * @private
- * @var string[]
- */
- public $ChangeLog = array();
-
- /**
- * Holds the note log.
- * @private
- * @var string[]
- */
- public $NoteLog = array();
-
/**
* @var string Default include path
*/
@@ -58,231 +39,13 @@ class PHPMailerLangTest extends PHPUnit_Framework_TestCase
*/
public function setUp()
{
-
- if (file_exists('./testbootstrap.php')) {
- include './testbootstrap.php'; //Overrides go in here
- }
- require_once $this->INCLUDE_DIR . 'class.phpmailer.php';
$this->Mail = new PHPMailer;
-
- $this->Mail->Priority = 3;
- $this->Mail->Encoding = "8bit";
- $this->Mail->CharSet = "iso-8859-1";
- if (array_key_exists('mail_from', $_REQUEST)) {
- $this->Mail->From = $_REQUEST['mail_from'];
- } else {
- $this->Mail->From = 'unit_test@phpmailer.example.com';
- }
- $this->Mail->FromName = "Unit Tester";
- $this->Mail->Sender = "";
- $this->Mail->Subject = "Unit Test";
- $this->Mail->Body = "";
- $this->Mail->AltBody = "";
- $this->Mail->WordWrap = 0;
- if (array_key_exists('mail_host', $_REQUEST)) {
- $this->Mail->Host = $_REQUEST['mail_host'];
- } else {
- $this->Mail->Host = 'mail.example.com';
- }
- if (array_key_exists('mail_port', $_REQUEST)) {
- $this->Mail->Port = $_REQUEST['mail_port'];
- } else {
- $this->Mail->Port = 25;
- }
- $this->Mail->Helo = "localhost.localdomain";
- $this->Mail->SMTPAuth = false;
- $this->Mail->Username = "";
- $this->Mail->Password = "";
- $this->Mail->PluginDir = $this->INCLUDE_DIR;
- $this->Mail->addReplyTo("no_reply@phpmailer.example.com", "Reply Guy");
- $this->Mail->Sender = "unit_test@phpmailer.example.com";
-
- if (strlen($this->Mail->Host) > 0) {
- $this->Mail->Mailer = "smtp";
- } else {
- $this->Mail->Mailer = "mail";
- $this->Mail->Sender = "unit_test@phpmailer.example.com";
- }
-
- if (array_key_exists('mail_to', $_REQUEST)) {
- $this->setAddress($_REQUEST['mail_to'], 'Test User', 'to');
- }
- if (array_key_exists('mail_cc', $_REQUEST) and strlen($_REQUEST['mail_cc']) > 0) {
- $this->setAddress($_REQUEST['mail_cc'], 'Carbon User', 'cc');
- }
- }
-
- /**
- * Run after each test is completed.
- */
- public function tearDown()
- {
- // Clean global variables
- $this->Mail = null;
- $this->ChangeLog = array();
- $this->NoteLog = array();
- }
-
-
- /**
- * Build the body of the message in the appropriate format.
- * @private
- * @returns void
- */
- public function buildBody()
- {
- $this->CheckChanges();
-
- // Determine line endings for message
- if ($this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0) {
- $eol = "
";
- $bullet = "