code: private function findFiles($dir)
      {
          $directory = new \RecursiveDirectoryIterator($dir);
          $iterator = new \RecursiveIteratorIterator($directory);
          $regex = new \RegexIterator($iterator, '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH);
  
          return $regex;
      }
docs: @param string $dir
  
  @return \RegexIterator