commit 08d014713a40958e6fd926b7bb1cd10c8b6aca8b Author: Tim Date: Tue Mar 18 19:01:15 2025 +0100 Start op project diff --git a/bundle.php b/bundle.php new file mode 100755 index 0000000..84116cd --- /dev/null +++ b/bundle.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +'); + exit(1); +} +$targetFile = $argv[1]; +if (!file_exists($targetFile)) { + line('File not found: ' . $targetFile); + exit(1); +} + +function getIncludes(string $file): array +{ + $content = file_get_contents($file); + $files = []; + foreach (explode("\n", $content) as $line) { + if (str_starts_with($line, 'include')) { + $line = "include 'test.include.php';"; + preg_match("/include\s+'([^']+)'/", $line, $matches); + $files[] = $matches[1]; + } + } + return $files; +} + +var_dump(getIncludes($targetFile)); + +function buildIncludeTree(string $file): array +{ + $includes = getIncludes($file); + foreach ($includes as $include) { + + } +} \ No newline at end of file diff --git a/test.include.php b/test.include.php new file mode 100644 index 0000000..5b9a833 --- /dev/null +++ b/test.include.php @@ -0,0 +1,3 @@ +