original_string: protected static function load_classes($component, $fulldir, $namespace = '') {
          if (!is_dir($fulldir)) {
              return;
          }
  
          if (!is_readable($fulldir)) {
              // TODO: MDL-51711 We should generate some diagnostic debugging information in this case
              // because its pretty likely to lead to a missing class error further down the line.
              // But our early setup code can't handle errors this early at the moment.
              return;
          }
  
          $items = new \DirectoryIterator($fulldir);
          foreach ($items as $item) {
              if ($item->isDot()) {
                  continue;
              }
              if ($item->isDir()) {
                  $dirname = $item->getFilename();
                  self::load_classes($component, "$fulldir/$dirname", $namespace.'\\'.$dirname);
                  continue;
              }
  
              $filename = $item->getFilename();
              $classname = preg_replace('/\.php$/', '', $filename);
  
              if ($filename === $classname) {
                  // Not a php file.
                  continue;
              }
              if ($namespace === '') {
                  // Legacy long frankenstyle class name.
                  self::$classmap[$component.'_'.$classname] = "$fulldir/$filename";
              }
              // New namespaced classes.
              self::$classmap[$component.$namespace.'\\'.$classname] = "$fulldir/$filename";
          }
          unset($item);
          unset($items);
      }
code: protected static function load_classes($component, $fulldir, $namespace = '') {
          if (!is_dir($fulldir)) {
              return;
          }
  
          if (!is_readable($fulldir)) {
              // TODO: MDL-51711 We should generate some diagnostic debugging information in this case
              // because its pretty likely to lead to a missing class error further down the line.
              // But our early setup code can't handle errors this early at the moment.
              return;
          }
  
          $items = new \DirectoryIterator($fulldir);
          foreach ($items as $item) {
              if ($item->isDot()) {
                  continue;
              }
              if ($item->isDir()) {
                  $dirname = $item->getFilename();
                  self::load_classes($component, "$fulldir/$dirname", $namespace.'\\'.$dirname);
                  continue;
              }
  
              $filename = $item->getFilename();
              $classname = preg_replace('/\.php$/', '', $filename);
  
              if ($filename === $classname) {
                  // Not a php file.
                  continue;
              }
              if ($namespace === '') {
                  // Legacy long frankenstyle class name.
                  self::$classmap[$component.'_'.$classname] = "$fulldir/$filename";
              }
              // New namespaced classes.
              self::$classmap[$component.$namespace.'\\'.$classname] = "$fulldir/$filename";
          }
          unset($item);
          unset($items);
      }
code_tokens: protected static function load_classes ( $ component , $ fulldir , $ namespace = '' ) { if ( ! is_dir ( $ fulldir ) ) { return ; } if ( ! is_readable ( $ fulldir ) ) { // TODO: MDL-51711 We should generate some diagnostic debugging information in this case // because its pretty likely to lead to a missing class error further down the line. // But our early setup code can't handle errors this early at the moment. return ; } $ items = new \ DirectoryIterator ( $ fulldir ) ; foreach ( $ items as $ item ) { if ( $ item -> isDot ( ) ) { continue ; } if ( $ item -> isDir ( ) ) { $ dirname = $ item -> getFilename ( ) ; self :: load_classes ( $ component , "$fulldir/$dirname" , $ namespace . '\\' . $ dirname ) ; continue ; } $ filename = $ item -> getFilename ( ) ; $ classname = preg_replace ( '/\.php$/' , '' , $ filename ) ; if ( $ filename === $ classname ) { // Not a php file. continue ; } if ( $ namespace === '' ) { // Legacy long frankenstyle class name. self :: $ classmap [ $ component . '_' . $ classname ] = "$fulldir/$filename" ; } // New namespaced classes. self :: $ classmap [ $ component . $ namespace . '\\' . $ classname ] = "$fulldir/$filename" ; } unset ( $ item ) ; unset ( $ items ) ; }
docstring: Find classes in directory and recurse to subdirs.
  @param string $component
  @param string $fulldir
  @param string $namespace
docstring_tokens: Find classes in directory and recurse to subdirs .