mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 11:22:40 +01:00
8ea13f3ce9
Summary: Ref T7984. With this, an install can add an ExternalSymbolsSource to src/extensions, which will include whatever source they have. Test Plan: search for php and python builtins. Reviewers: joshuaspence, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7984 Differential Revision: https://secure.phabricator.com/D13036
49 lines
1.5 KiB
PHP
49 lines
1.5 KiB
PHP
<?php
|
|
|
|
final class DiffusionPhpExternalSymbolsSource
|
|
extends DiffusionExternalSymbolsSource {
|
|
|
|
public function executeQuery(DiffusionExternalSymbolQuery $query) {
|
|
$symbols = array();
|
|
|
|
if (!$query->matchesAnyLanguage(array('php'))) {
|
|
return $symbols;
|
|
}
|
|
|
|
$names = $query->getNames();
|
|
|
|
if ($query->matchesAnyType(array('function'))) {
|
|
$functions = get_defined_functions();
|
|
$functions = $functions['internal'];
|
|
|
|
foreach ($names as $name) {
|
|
if (in_array($name, $functions)) {
|
|
$symbols[] = $this->buildExternalSymbol()
|
|
->setSymbolName($name)
|
|
->setSymbolType('function')
|
|
->setSource(pht('PHP'))
|
|
->setLocation(pht('Manual at php.net'))
|
|
->setSymbolLanguage('php')
|
|
->setExternalURI('http://www.php.net/function.'.$name);
|
|
}
|
|
}
|
|
}
|
|
if ($query->matchesAnyType(array('class'))) {
|
|
foreach ($names as $name) {
|
|
if (class_exists($name, false) || interface_exists($name, false)) {
|
|
if (id(new ReflectionClass($name))->isInternal()) {
|
|
$symbols[] = $this->buildExternalSymbol()
|
|
->setSymbolName($name)
|
|
->setSymbolType('class')
|
|
->setSource(pht('PHP'))
|
|
->setLocation(pht('Manual at php.net'))
|
|
->setSymbolLanguage('php')
|
|
->setExternalURI('http://www.php.net/class.'.$name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return $symbols;
|
|
}
|
|
}
|