Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / diffusion / symbol / DiffusionPhpExternalSymbolsSource.php
blob455d2371759eae21ed9b4899ce9c7ec8aab4de44
1 <?php
3 final class DiffusionPhpExternalSymbolsSource
4 extends DiffusionExternalSymbolsSource {
6 public function executeQuery(DiffusionExternalSymbolQuery $query) {
7 $symbols = array();
9 if (!$query->matchesAnyLanguage(array('php'))) {
10 return $symbols;
13 $names = $query->getNames();
15 if ($query->matchesAnyType(array('function'))) {
16 $functions = get_defined_functions();
17 $functions = $functions['internal'];
19 foreach ($names as $name) {
20 if (in_array($name, $functions)) {
21 $symbols[] = $this->buildExternalSymbol()
22 ->setSymbolName($name)
23 ->setSymbolType('function')
24 ->setSource(pht('PHP'))
25 ->setLocation(pht('Manual at php.net'))
26 ->setSymbolLanguage('php')
27 ->setExternalURI('http://www.php.net/function.'.$name);
31 if ($query->matchesAnyType(array('class'))) {
32 foreach ($names as $name) {
33 if (class_exists($name, false) || interface_exists($name, false)) {
34 if (id(new ReflectionClass($name))->isInternal()) {
35 $symbols[] = $this->buildExternalSymbol()
36 ->setSymbolName($name)
37 ->setSymbolType('class')
38 ->setSource(pht('PHP'))
39 ->setLocation(pht('Manual at php.net'))
40 ->setSymbolLanguage('php')
41 ->setExternalURI('http://www.php.net/class.'.$name);
47 return $symbols;