const fs = require('fs');
const path = require('path');

// Search for VoucherGenerator.class.php in the repository
function findFile(dir, name) {
  const items = fs.readdirSync(dir);
  for (const item of items) {
    const p = path.join(dir, item);
    const stat = fs.statSync(p);
    if (stat.isDirectory()) {
      if (item !== 'node_modules' && item !== '.git') {
        const res = findFile(p, name);
        if (res) return res;
      }
    } else if (item.toLowerCase() === name.toLowerCase()) {
      return p;
    }
  }
  return null;
}

const p = findFile('.', 'VoucherGenerator.class.php');
if (p) {
  console.log(`Found VoucherGenerator.class.php at: ${p}`);
  const content = fs.readFileSync(p, 'utf8');
  console.log(content.substring(0, 1500));
} else {
  console.log("VoucherGenerator.class.php not found!");
}
