private function findPackageName($path, &$header = null)
{
$grep_res = (new ExecCmd("grep"))->run(array_merge(["-HEo", "phpext_[^ ]+_ptr"], explode("\n", (new ExecCmd("find"))->run([$path, "-type", "f", "-name", "php_*.h"])->getOutput())))->getOutput();
if (!(list($header, $phpext_ptr) = explode(":", $grep_res))) {
return [];
}
if (!($name = substr($phpext_ptr, 7, -4))) {
return [];
}
return $name;
}