public function getPluginDescription($file)
{
$content = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$data = [];
$insideHeader = false;
foreach ($content as $line) {
if (!$insideHeader and strpos($line, "/**") !== false) {
$insideHeader = true;
}
if (preg_match("/^[ \t]+\\*[ \t]+@([a-zA-Z]+)([ \t]+(.*))?\$/", $line, $matches) > 0) {
$key = $matches[1];
$content = trim($matches[3] ?? "");
if ($key === "notscript") {
return null;
}
$data[$key] = $content;
}
if ($insideHeader and strpos($line, "**/") !== false) {
break;
}
}
if ($insideHeader) {
return new PluginDescription($data);
}
return null;
}