Completed
Push — master ( 819fc9...f42eea )
by Goffy
18s queued 11s
created

PHPMailerAutoload.php ➔ __autoload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * PHPMailer SPL autoloader.
4
 * PHP Version 5
5
 * @package   PHPMailer
6
 * @link      https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
7
 * @author    Marcus Bointon (Synchro/coolbru) <[email protected]>
8
 * @author    Jim Jagielski (jimjag) <[email protected]>
9
 * @author    Andy Prevost (codeworxtech) <[email protected]>
10
 * @author    Brent R. Matzelle (original founder)
11
 * @copyright 2012 - 2014 Marcus Bointon
12
 * @copyright 2010 - 2012 Jim Jagielski
13
 * @copyright 2004 - 2009 Andy Prevost
14
 * @license   http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
15
 * @note      This program is distributed in the hope that it will be useful - WITHOUT
16
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
 * FITNESS FOR A PARTICULAR PURPOSE.
18
 * @param mixed $classname
19
 */
20
21
/**
22
 * PHPMailer SPL autoloader.
23
 * @param string $classname The name of the class to load
24
 */
25
function PHPMailerAutoload($classname)
26
{
27
    //Can't use __DIR__ as it's only in PHP 5.3+
28
    $filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class.' . mb_strtolower($classname) . '.php';
29
    if (is_readable($filename)) {
30
        require $filename;
31
    }
32
}
33
34
//SPL autoloading was introduced in PHP 5.1.2
35
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
36
    spl_autoload_register('PHPMailerAutoload', true, true);
37
} else {
38
    spl_autoload_register('PHPMailerAutoload');
39
}
40
41