original_string: public static function autoload( $className )
      {
          Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '(%s)', $className);
          ezcBase::setPackageDir();
  
          // Check whether the classname is already in the cached autoloadArray.
          if ( array_key_exists( $className, ezcBase::$autoloadArray ) )
          {
              // Is it registered as 'unloadable'?
              if ( ezcBase::$autoloadArray[$className] == false )
              {
                  return false;
              }
              ezcBase::loadFile( ezcBase::$autoloadArray[$className] );
  
              return true;
          }
  
          // Check whether the classname is already in the cached autoloadArray
          // for external repositories.
          if ( array_key_exists( $className, ezcBase::$externalAutoloadArray ) )
          {
              // Is it registered as 'unloadable'?
              if ( ezcBase::$externalAutoloadArray[$className] == false )
              {
                  return false;
              }
              ezcBase::loadExternalFile( ezcBase::$externalAutoloadArray[$className] );
  
              return true;
          }
  
          // Not cached, so load the autoload from the package.
          // Matches the first and optionally the second 'word' from the classname.
          $fileNames = array();
          if ( preg_match( "/^([a-z0-9]*)([A-Z][a-z0-9]*)?([A-Z][a-z0-9]*)?/", $className, $matches ) !== false )
          {
              $autoloadFile = "";
              // Try to match with both names, if available.
              switch ( sizeof( $matches ) )
              {
                  case 4:
                      // check for x_y_autoload.php
                      $autoloadFile = strtolower( "{$matches[2]}_{$matches[3]}_autoload.php" );
                      $fileNames[] = $autoloadFile;
                      if ( ezcBase::requireFile( $autoloadFile, $className, $matches[1] ) )
                      {
                          return true;
                      }
                      // break intentionally missing.
  
                  case 3:
                      // check for x_autoload.php
                      $autoloadFile = strtolower( "{$matches[2]}_autoload.php" );
                      $fileNames[] = $autoloadFile;
                      if ( ezcBase::requireFile( $autoloadFile, $className, $matches[1] ) )
                      {
                          return true;
                      }
                      // break intentionally missing.
  
                  case 2:
                      // check for autoload.php
                      $autoloadFile = 'autoload.php';
                      $fileNames[] = $autoloadFile;
                      if ( ezcBase::requireFile( $autoloadFile, $className, $matches[1] ) )
                      {
                          return true;
                      }
                      break;
              }
  
              // Maybe there is another autoload available.
              // Register this classname as false.
              ezcBase::$autoloadArray[$className] = false;
          }
  
          $path = ezcBase::$packageDir . 'autoload/';
          $realPath = realpath( $path );
  
          if ( $realPath == '' )
          {
              // Can not be tested, because if this happens, then the autoload
              // environment has not been set-up correctly.
              trigger_error( "Couldn't find autoload directory '$path'", E_USER_ERROR );
          }
  
          $dirs = self::getRepositoryDirectories();
          if ( ezcBase::$options && ezcBase::$options->debug )
          {
              throw new ezcBaseAutoloadException( $className, $fileNames, $dirs );
          }
  
          return false;
      }
code: public static function autoload( $className )
      {
          Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '(%s)', $className);
          ezcBase::setPackageDir();
  
          // Check whether the classname is already in the cached autoloadArray.
          if ( array_key_exists( $className, ezcBase::$autoloadArray ) )
          {
              // Is it registered as 'unloadable'?
              if ( ezcBase::$autoloadArray[$className] == false )
              {
                  return false;
              }
              ezcBase::loadFile( ezcBase::$autoloadArray[$className] );
  
              return true;
          }
  
          // Check whether the classname is already in the cached autoloadArray
          // for external repositories.
          if ( array_key_exists( $className, ezcBase::$externalAutoloadArray ) )
          {
              // Is it registered as 'unloadable'?
              if ( ezcBase::$externalAutoloadArray[$className] == false )
              {
                  return false;
              }
              ezcBase::loadExternalFile( ezcBase::$externalAutoloadArray[$className] );
  
              return true;
          }
  
          // Not cached, so load the autoload from the package.
          // Matches the first and optionally the second 'word' from the classname.
          $fileNames = array();
          if ( preg_match( "/^([a-z0-9]*)([A-Z][a-z0-9]*)?([A-Z][a-z0-9]*)?/", $className, $matches ) !== false )
          {
              $autoloadFile = "";
              // Try to match with both names, if available.
              switch ( sizeof( $matches ) )
              {
                  case 4:
                      // check for x_y_autoload.php
                      $autoloadFile = strtolower( "{$matches[2]}_{$matches[3]}_autoload.php" );
                      $fileNames[] = $autoloadFile;
                      if ( ezcBase::requireFile( $autoloadFile, $className, $matches[1] ) )
                      {
                          return true;
                      }
                      // break intentionally missing.
  
                  case 3:
                      // check for x_autoload.php
                      $autoloadFile = strtolower( "{$matches[2]}_autoload.php" );
                      $fileNames[] = $autoloadFile;
                      if ( ezcBase::requireFile( $autoloadFile, $className, $matches[1] ) )
                      {
                          return true;
                      }
                      // break intentionally missing.
  
                  case 2:
                      // check for autoload.php
                      $autoloadFile = 'autoload.php';
                      $fileNames[] = $autoloadFile;
                      if ( ezcBase::requireFile( $autoloadFile, $className, $matches[1] ) )
                      {
                          return true;
                      }
                      break;
              }
  
              // Maybe there is another autoload available.
              // Register this classname as false.
              ezcBase::$autoloadArray[$className] = false;
          }
  
          $path = ezcBase::$packageDir . 'autoload/';
          $realPath = realpath( $path );
  
          if ( $realPath == '' )
          {
              // Can not be tested, because if this happens, then the autoload
              // environment has not been set-up correctly.
              trigger_error( "Couldn't find autoload directory '$path'", E_USER_ERROR );
          }
  
          $dirs = self::getRepositoryDirectories();
          if ( ezcBase::$options && ezcBase::$options->debug )
          {
              throw new ezcBaseAutoloadException( $className, $fileNames, $dirs );
          }
  
          return false;
      }
code_tokens: public static function autoload ( $ className ) { Eresus_Kernel :: log ( __METHOD__ , LOG_DEBUG , '(%s)' , $ className ) ; ezcBase :: setPackageDir ( ) ; // Check whether the classname is already in the cached autoloadArray. if ( array_key_exists ( $ className , ezcBase :: $ autoloadArray ) ) { // Is it registered as 'unloadable'? if ( ezcBase :: $ autoloadArray [ $ className ] == false ) { return false ; } ezcBase :: loadFile ( ezcBase :: $ autoloadArray [ $ className ] ) ; return true ; } // Check whether the classname is already in the cached autoloadArray // for external repositories. if ( array_key_exists ( $ className , ezcBase :: $ externalAutoloadArray ) ) { // Is it registered as 'unloadable'? if ( ezcBase :: $ externalAutoloadArray [ $ className ] == false ) { return false ; } ezcBase :: loadExternalFile ( ezcBase :: $ externalAutoloadArray [ $ className ] ) ; return true ; } // Not cached, so load the autoload from the package. // Matches the first and optionally the second 'word' from the classname. $ fileNames = array ( ) ; if ( preg_match ( "/^([a-z0-9]*)([A-Z][a-z0-9]*)?([A-Z][a-z0-9]*)?/" , $ className , $ matches ) !== false ) { $ autoloadFile = "" ; // Try to match with both names, if available. switch ( sizeof ( $ matches ) ) { case 4 : // check for x_y_autoload.php $ autoloadFile = strtolower ( "{$matches[2]}_{$matches[3]}_autoload.php" ) ; $ fileNames [ ] = $ autoloadFile ; if ( ezcBase :: requireFile ( $ autoloadFile , $ className , $ matches [ 1 ] ) ) { return true ; } // break intentionally missing. case 3 : // check for x_autoload.php $ autoloadFile = strtolower ( "{$matches[2]}_autoload.php" ) ; $ fileNames [ ] = $ autoloadFile ; if ( ezcBase :: requireFile ( $ autoloadFile , $ className , $ matches [ 1 ] ) ) { return true ; } // break intentionally missing. case 2 : // check for autoload.php $ autoloadFile = 'autoload.php' ; $ fileNames [ ] = $ autoloadFile ; if ( ezcBase :: requireFile ( $ autoloadFile , $ className , $ matches [ 1 ] ) ) { return true ; } break ; } // Maybe there is another autoload available. // Register this classname as false. ezcBase :: $ autoloadArray [ $ className ] = false ; } $ path = ezcBase :: $ packageDir . 'autoload/' ; $ realPath = realpath ( $ path ) ; if ( $ realPath == '' ) { // Can not be tested, because if this happens, then the autoload // environment has not been set-up correctly. trigger_error ( "Couldn't find autoload directory '$path'" , E_USER_ERROR ) ; } $ dirs = self :: getRepositoryDirectories ( ) ; if ( ezcBase :: $ options && ezcBase :: $ options -> debug ) { throw new ezcBaseAutoloadException ( $ className , $ fileNames , $ dirs ) ; } return false ; }
docstring: Tries to autoload the given className. If the className could be found
  this method returns true, otherwise false.
  
  This class caches the requested class names (including the ones who
  failed to load).
  
  @param string $className  The name of the class that should be loaded.
  
  @return bool
docstring_tokens: Tries to autoload the given className . If the className could be found this method returns true otherwise false .