From 08d014713a40958e6fd926b7bb1cd10c8b6aca8b Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 18 Mar 2025 19:01:15 +0100 Subject: [PATCH] Start op project --- bundle.php | 41 +++++++++++++++++++++++++++++++++++++++++ test.include.php | 3 +++ test.php | 6 ++++++ 3 files changed, 50 insertions(+) create mode 100755 bundle.php create mode 100644 test.include.php create mode 100755 test.php 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 @@ +