<?php

$dir = new RecursiveDirectoryIterator(__DIR__ . '/../vendor/filament');
$iterator = new RecursiveIteratorIterator($dir);
$regex = new RegexIterator($iterator, '/^.+\.blade\.php$/i', RecursiveRegexIterator::GET_MATCH);

foreach ($regex as $info) {
    $file = $info[0];
    $content = file_get_contents($file);
    if (str_contains($content, 'getFormActions') || str_contains($content, 'formActions')) {
        $relative = str_replace(realpath(__DIR__ . '/..'), '', realpath($file));
        echo "Found in $relative:\n";
        // print lines containing it
        $lines = explode("\n", $content);
        foreach ($lines as $num => $line) {
            if (str_contains($line, 'getFormActions') || str_contains($line, 'formActions')) {
                echo "  Line " . ($num + 1) . ": " . trim($line) . "\n";
            }
        }
    }
}
