public static function autoload($klass) {
    $components = explode('\\', $klass);
    if (empty($components[0])) {
      array_shift($components);
    }

    // This class loader ONLY loads
    // our classes. A general purpose
    // classloader should be used for
    // more sophisticated needs.
    if ($components[0] != 'HPCloud') {
      return;
    }

    // We need the path up to, but not including, the root HPCloud dir:
    $loc = DIRECTORY_SEPARATOR . 'HPCloud';
    $local_path = substr(self::$basedir, 0, strrpos(self::$basedir, $loc));

    array_unshift($components, $local_path);
    $path = implode(DIRECTORY_SEPARATOR, $components) . '.php';

    if (file_exists($path)) {
      require $path;
      return;
    }
  }
public static function autoload($klass) {
    $components = explode('\\', $klass);
    if (empty($components[0])) {
      array_shift($components);
    }

    // This class loader ONLY loads
    // our classes. A general purpose
    // classloader should be used for
    // more sophisticated needs.
    if ($components[0] != 'HPCloud') {
      return;
    }

    // We need the path up to, but not including, the root HPCloud dir:
    $loc = DIRECTORY_SEPARATOR . 'HPCloud';
    $local_path = substr(self::$basedir, 0, strrpos(self::$basedir, $loc));

    array_unshift($components, $local_path);
    $path = implode(DIRECTORY_SEPARATOR, $components) . '.php';

    if (file_exists($path)) {
      require $path;
      return;
    }
  }
public static function autoload ( $ klass ) { $ components = explode ( '\\' , $ klass ) ; if ( empty ( $ components [ 0 ] ) ) { array_shift ( $ components ) ; } // This class loader ONLY loads // our classes. A general purpose // classloader should be used for // more sophisticated needs. if ( $ components [ 0 ] != 'HPCloud' ) { return ; } // We need the path up to, but not including, the root HPCloud dir: $ loc = DIRECTORY_SEPARATOR . 'HPCloud' ; $ local_path = substr ( self :: $ basedir , 0 , strrpos ( self :: $ basedir , $ loc ) ) ; array_unshift ( $ components , $ local_path ) ; $ path = implode ( DIRECTORY_SEPARATOR , $ components ) . '.php' ; if ( file_exists ( $ path ) ) { require $ path ; return ; } }
HPCloud autoloader.

An implementation of a PHP autoload function. Use
HPCloud::useAutoloader() if you want PHP to automatically
load classes using this autoloader.

@code
// Enable the autoloader.
Bootstrap::useAutoloader();
@endcode

This is a special-purpose autoloader for loading
only the HPCloud classes. It will not attempt to
autoload anything outside of the HPCloud namespace.

Because this is a special-purpose autoloader, it
should be safe to use with other special-purpose
autoloaders (and also projects that don't
rely upon autoloaders).

@param string $klass
The fully qualified name of the class to be autoloaded.
HPCloud autoloader .