Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
catalog = $catalog ?? new SymbolCatalog();
}
/**
* {@inheritdoc}
*/
public function appliesToKind(int $kinds): bool
{
return ($kinds & CompletionKind::NAMESPACE) !== 0;
}
/**
* {@inheritdoc}
*/
public function getCompletions(AnalysisResult $analysis): array
{
$prefix = $analysis->prefix;
$namespaces = $this->catalog->getNamespaces();
// Filter by prefix (case-insensitive)
$matches = [];
$lowerPrefix = \strtolower($prefix);
foreach ($namespaces as $namespace) {
if ($lowerPrefix === '' || \strpos(\strtolower($namespace), $lowerPrefix) === 0) {
$matches[] = $namespace;
}
}
\sort($matches);
return $matches;
}
}