autoload() public static method

Autoload static method for loading classes and interfaces.
public static autoload ( string $className ) : void
$className string The name of the class or interface.
return void
Esempio n. 1
0
 /**
  * Autoload static method for loading classes and interfaces.
  *
  * @param string $className The name of the class or interface.
  *
  * @return void
  */
 public static function autoload($className)
 {
     if (substr($className, 0, 5) === 'SQLI_') {
         $newClassName = substr($className, 5);
     } else {
         $newClassName = $className;
     }
     $path = str_replace('_', '/', $newClassName) . '.php';
     if (is_file(dirname(__FILE__) . '/' . $path)) {
         // Check standard file locations based on class name.
         include dirname(__FILE__) . '/' . $path;
     } else {
         if (is_file(dirname(__FILE__) . '/CodeSniffer/Standards/' . $path)) {
             // Check for included sniffs in SQLI
             include dirname(__FILE__) . '/CodeSniffer/Standards/' . $path;
         } else {
             parent::autoload($className);
         }
     }
 }