My favorites | Sign in
Project Logo
                
Changes to /trunk/Panda/Loader/Singleton.php
r0 vs. r108   Edit
  Compare: vs.   Format:
Revision r108
Go to: 
Project members, sign in to write a code review
/trunk/Panda/Loader/Singleton.php   r0 /trunk/Panda/Loader/Singleton.php   r108
  1 <?php
  2
  3 require 'Panda/Loader/Abstract.php';
  4
  5 /**
  6 * A singleton source loader
  7 *
  8 * @package Panda_Loader
  9 * @author Michael Girouard
  10 * @license The New BSD License (http://pandaphp.org/license.html)
  11 */
  12 class Panda_Loader_Singleton
  13 extends Panda_Loader_Abstract
  14 {
  15 /**
  16 * Returns a singleton instance
  17 *
  18 * @return Panda_Loader_Singleton
  19 */
  20 public static function singleton()
  21 {
  22 static $Instance;
  23
  24 if ($Instance === null) {
  25 $Instance = new self;
  26 }
  27
  28 return $Instance;
  29 }
  30
  31 /**
  32 * An autoloader which for use with SPL
  33 *
  34 * @param string $className
  35 * @return bool
  36 */
  37 public static function autoload($className)
  38 {
  39 return self::singleton()->load($className);
  40 }
  41 }
Hosted by Google Code