src/php/Webforge/Common/System/File.php
public function findExtension(Array $possibleExtensions) {
    foreach ($possibleExtensions as $extension) {
      $file = clone $this;
      $file->setExtension($extension);

      if ($file->exists()) {
        return $file;
      }
    }

    throw FileNotFoundException::fromFileAndExtensions($this, $possibleExtensions);
  }
public function findExtension(Array $possibleExtensions) {
    foreach ($possibleExtensions as $extension) {
      $file = clone $this;
      $file->setExtension($extension);

      if ($file->exists()) {
        return $file;
      }
    }

    throw FileNotFoundException::fromFileAndExtensions($this, $possibleExtensions);
  }
public function findExtension ( Array $ possibleExtensions ) { foreach ( $ possibleExtensions as $ extension ) { $ file = clone $ this ; $ file -> setExtension ( $ extension ) ; if ( $ file -> exists ( ) ) { return $ file ; } } throw FileNotFoundException :: fromFileAndExtensions ( $ this , $ possibleExtensions ) ; }
Returns the first file that exists with one of the given extensions

Dir contents:
thefile.js
thefile.php
thefile.csv

$dir->getFile('thefile')->findExtension(array('php', 'js', 'csv')); // returns thefile.php
$dir->getFile('thefile')->findExtension(array('js', 'csv')); // returns thefile.js
$dir->getFile('thefile')->findExtension(array('html', 'csv')); // returns thefile.csv
Returns the first file that exists with one of the given extensions