original_string: protected function scanDirectory($path, $extensions)
      {
          if (is_file($path)) {
              $file = new \SplFileInfo($path);
              return array($this->getFileKey($file->getPath(), $file) => $file);
          }
          
          $files = array();
          $extensions = (array) $extensions;
          $iterator = new \RecursiveIteratorIterator(
              new \RecursiveDirectoryIterator(
                  $path, 
                  \FileSystemIterator::SKIP_DOTS 
                      | \FileSystemIterator::CURRENT_AS_FILEINFO)    
          );
          foreach ($iterator as $file) {
              if (in_array($file->getExtension(), $extensions)) {
                  $files[$this->getFileKey($path, $file)] = $file;
              }
          }
          return $files;
      }
code: protected function scanDirectory($path, $extensions)
      {
          if (is_file($path)) {
              $file = new \SplFileInfo($path);
              return array($this->getFileKey($file->getPath(), $file) => $file);
          }
          
          $files = array();
          $extensions = (array) $extensions;
          $iterator = new \RecursiveIteratorIterator(
              new \RecursiveDirectoryIterator(
                  $path, 
                  \FileSystemIterator::SKIP_DOTS 
                      | \FileSystemIterator::CURRENT_AS_FILEINFO)    
          );
          foreach ($iterator as $file) {
              if (in_array($file->getExtension(), $extensions)) {
                  $files[$this->getFileKey($path, $file)] = $file;
              }
          }
          return $files;
      }
code_tokens: protected function scanDirectory ( $ path , $ extensions ) { if ( is_file ( $ path ) ) { $ file = new \ SplFileInfo ( $ path ) ; return array ( $ this -> getFileKey ( $ file -> getPath ( ) , $ file ) => $ file ) ; } $ files = array ( ) ; $ extensions = ( array ) $ extensions ; $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ path , \ FileSystemIterator :: SKIP_DOTS | \ FileSystemIterator :: CURRENT_AS_FILEINFO ) ) ; foreach ( $ iterator as $ file ) { if ( in_array ( $ file -> getExtension ( ) , $ extensions ) ) { $ files [ $ this -> getFileKey ( $ path , $ file ) ] = $ file ; } } return $ files ; }
docstring: Scan a directory and return a list of files with matching extenstions
  
  @param string $path Directory path to scan
  @param string|array $extensions Match files with these extensions
docstring_tokens: Scan a directory and return a list of files with matching extenstions