1<?php
2
3/**
4 * Swift Mailer Class Loader for includes
5 * Please read the LICENSE file
6 * @author Chris Corbyn <chris@w3style.co.uk>
7 * @package Swift
8 * @license GNU Lesser General Public License
9 */
10
11if (!defined("SWIFT_ABS_PATH")) define("SWIFT_ABS_PATH", dirname(__FILE__) . "/..");
12
13/**
14 * Locates and includes class files
15 * @package Swift
16 * @author Chris Corbyn <chris@w3style.co.uk>
17 */
18class Swift_ClassLoader
19{
20  /**
21   * A list of files already located
22   * @var array
23   */
24  protected static $located = array();
25
26  /**
27   * Load a new class into memory
28   * @param string The name of the class, case SenSItivE
29   */
30  public static function load($name)
31  {
32    if (in_array($name, self::$located) || class_exists($name, false) || interface_exists($name, false))
33      return;
34
35    require_once SWIFT_ABS_PATH . "/" . str_replace("_", "/", $name) . ".php";
36    self::$located[] = $name;
37  }
38}
39