src/AvatarServiceDiscovery.php
protected function discoverClasses(array $namespaces) : array {
    $classes = [];

    foreach ($namespaces as $namespace => $namespace_directories) {
      $namespace_directories = array_filter($namespace_directories, function ($dir) {
        return is_dir($dir);
      });
      foreach ($namespace_directories as $namespace_directory) {
        $finder = $this->createFinder()
          ->files()
          ->name('*.php')
          ->in($namespace_directory)
          ->path($this->subdir);
        foreach ($finder as $file) {
          // Remove the namespace directory from the full file path.
          $sub_path = substr($file->getPath(), strlen($namespace_directory));
          if (!empty($sub_path)) {
            $sub_path = substr($sub_path, 1);
            $sub_path = str_replace('/', '\\', $sub_path);
            $sub_path .= '\\';
            $classes[] = $namespace . $sub_path . $file->getBasename('.php');
          }
        }
      }
    }

    return $classes;
  }
protected function discoverClasses(array $namespaces) : array {
    $classes = [];

    foreach ($namespaces as $namespace => $namespace_directories) {
      $namespace_directories = array_filter($namespace_directories, function ($dir) {
        return is_dir($dir);
      });
      foreach ($namespace_directories as $namespace_directory) {
        $finder = $this->createFinder()
          ->files()
          ->name('*.php')
          ->in($namespace_directory)
          ->path($this->subdir);
        foreach ($finder as $file) {
          // Remove the namespace directory from the full file path.
          $sub_path = substr($file->getPath(), strlen($namespace_directory));
          if (!empty($sub_path)) {
            $sub_path = substr($sub_path, 1);
            $sub_path = str_replace('/', '\\', $sub_path);
            $sub_path .= '\\';
            $classes[] = $namespace . $sub_path . $file->getBasename('.php');
          }
        }
      }
    }

    return $classes;
  }
protected function discoverClasses ( array $ namespaces ) : array { $ classes = [ ] ; foreach ( $ namespaces as $ namespace => $ namespace_directories ) { $ namespace_directories = array_filter ( $ namespace_directories , function ( $ dir ) { return is_dir ( $ dir ) ; } ) ; foreach ( $ namespace_directories as $ namespace_directory ) { $ finder = $ this -> createFinder ( ) -> files ( ) -> name ( '*.php' ) -> in ( $ namespace_directory ) -> path ( $ this -> subdir ) ; foreach ( $ finder as $ file ) { // Remove the namespace directory from the full file path. $ sub_path = substr ( $ file -> getPath ( ) , strlen ( $ namespace_directory ) ) ; if ( ! empty ( $ sub_path ) ) { $ sub_path = substr ( $ sub_path , 1 ) ; $ sub_path = str_replace ( '/' , '\\' , $ sub_path ) ; $ sub_path .= '\\' ; $ classes [ ] = $ namespace . $ sub_path . $ file -> getBasename ( '.php' ) ; } } } } return $ classes ; }
Discover files that look like avatar service classes.

@param array $namespaces
An array of namespaces where keys are namespaces and values are
directories.

@return string[]
An array of classes.
Discover files that look like avatar service classes .