original_string: public function scanLocales($sourceDir)
      {
          $locales = glob($sourceDir.'/*.txt');
  
          // Remove file extension and sort
          array_walk($locales, function (&$locale) { $locale = basename($locale, '.txt'); });
  
          // Remove non-locales
          $locales = array_filter($locales, function ($locale) {
              return preg_match('/^[a-z]{2}(_.+)?$/', $locale);
          });
  
          sort($locales);
  
          return $locales;
      }
code: public function scanLocales($sourceDir)
      {
          $locales = glob($sourceDir.'/*.txt');
  
          // Remove file extension and sort
          array_walk($locales, function (&$locale) { $locale = basename($locale, '.txt'); });
  
          // Remove non-locales
          $locales = array_filter($locales, function ($locale) {
              return preg_match('/^[a-z]{2}(_.+)?$/', $locale);
          });
  
          sort($locales);
  
          return $locales;
      }
code_tokens: public function scanLocales ( $ sourceDir ) { $ locales = glob ( $ sourceDir . '/*.txt' ) ; // Remove file extension and sort array_walk ( $ locales , function ( & $ locale ) { $ locale = basename ( $ locale , '.txt' ) ; } ) ; // Remove non-locales $ locales = array_filter ( $ locales , function ( $ locale ) { return preg_match ( '/^[a-z]{2}(_.+)?$/' , $ locale ) ; } ) ; sort ( $ locales ) ; return $ locales ; }
docstring: Returns all locales found in the given directory.
  
  @param string $sourceDir The directory with ICU files
  
  @return array An array of locales. The result also contains locales that
  are in fact just aliases for other locales. Use
  {@link scanAliases()} to determine which of the locales
  are aliases
docstring_tokens: Returns all locales found in the given directory .