22 lines
521 B
PHP
22 lines
521 B
PHP
<?php
|
|
|
|
function getLineIncludeFile(string $line): false|string
|
|
{
|
|
preg_match("/include\s+'([^']+\.php)'/", $line, $matches);
|
|
if (count($matches) === 2) {
|
|
return $matches[1];
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function buildIncludes(string $file, array &$includes): void
|
|
{
|
|
foreach (getAllLines($file) as $line) {
|
|
$includeFile = getLineIncludeFile($line);
|
|
if ($includeFile) {
|
|
buildIncludes($includeFile, $includes);
|
|
}
|
|
}
|
|
$includes[$file] = true;
|
|
}
|