public function getEntries(Project $project, Context $context) { $entries = []; foreach ($project->getIndex()->getInterfaces() as $interface) { $fqcn = $interface->fqcn; $entries[] = new Entry($fqcn->toString()); } return $entries; }
protected function filterFiles(Project $project, $files) { $projectFiles = []; foreach ($files as $file) { if (!preg_match('/\\.php$/', $file)) { continue; } $projectFiles[] = $this->path->relative($project->getRootDir(), $file); } return $projectFiles; }
public function getEntries(Project $project, Context $context) { $entries = []; $postfix = trim(""); foreach ($project->getIndex()->getClasses() as $fqcn => $class) { if (!empty($postfix) && strpos($fqcn, $postfix) === false) { continue; } $fqcn = $context->getScope()->getUses()->findAlias($class->fqcn); $complete = str_replace($postfix, "", $fqcn); $entries[] = new Entry($complete, '', '', $fqcn); } return $entries; }
public function getEntries(Project $project, Context $context) { $entries = []; $postfix = trim($context->getData()); $index = $project->getIndex(); $fqcns = array_merge($index->getClasses(), $index->getInterfaces()); foreach ($fqcns as $fqcn => $class) { if (!empty($postfix) && strpos($fqcn, $postfix) === false) { continue; } $complete = str_replace($postfix, "", $fqcn); $entries[] = new Entry($complete, '', '', $fqcn); } return $entries; }
public function getEntries(Project $project, Context $context) { $entries = []; $postfix = trim($context->getData()); foreach ($project->getIndex()->getFQCNs() as $fqcn) { $namespace = $fqcn->getNamespace(); if (!empty($postfix) && strpos($namespace, $postfix) === false) { continue; } $complete = str_replace($postfix, "", $namespace); $entries[$namespace] = new Entry($complete, "", "", $namespace); } $entries = array_values($entries); return $entries; }
public function getEntries(Project $project, Context $context) { /** @var FQCN $fqcn */ list($fqcn, $isThis) = $context->getData(); $this->logger->debug('creating static entries'); if (!$fqcn instanceof FQCN) { return []; } $index = $project->getIndex(); $this->logger->debug('Creating completion for ' . $fqcn->toString()); $class = $index->findClassByFQCN($fqcn); if (empty($class)) { $class = $index->findInterfaceByFQCN($fqcn); } if (empty($class)) { return []; } $entries = []; $spec = new Specification($isThis ? 'private' : 'public', 1); if ($class->methods !== null) { foreach ($class->methods->all($spec) as $method) { $entry = $this->createEntryForMethod($method); $entries[$method->name] = $entry; } } if ($class instanceof InterfaceData) { return $entries; } if ($class->properties !== null) { foreach ($class->properties->all($spec) as $property) { $entries[$property->name] = $this->createEntryForProperty($property); } } if ($class->constants !== null) { foreach ($class->constants->all() as $const) { $entries[$const] = $this->createEntryForConst($const); } } ksort($entries); return $entries; }
/** * @return Scope */ protected function processFileContent(Project $project, $lines, $line, $file) { if (is_array($lines)) { $content = implode("\n", $lines); } else { $content = $lines; } if (empty($content)) { return; } if (!array_key_exists($file, $this->cachePool)) { $this->cachePool[$file] = [0, [], []]; } if ($this->isValidCache($file, $content)) { list(, , $scopeNodes) = $this->cachePool[$file]; } if (empty($scopeNodes)) { $this->indexProcessor->clearResultNodes(); $parser = $this->parser; $parser->addProcessor($this->indexProcessor); $nodes = $parser->parseContent($file, $content); $this->generator->processFileScope($project->getIndex(), $nodes); /** @var \Entity\Node\Uses */ $uses = $parser->getUses(); $this->scopeProcessor->setIndex($project->getIndex()); $this->scopeProcessor->setLine($line); $this->scopeProcessor->clearResultNodes(); $parser->addProcessor($this->scopeProcessor); $scopeNodes = $parser->parseContent($file, $content, $uses); $contentHash = hash('sha1', $content); $this->cachePool[$file] = [$contentHash, $nodes, $scopeNodes]; } if (count($scopeNodes)) { return $scopeNodes[0]; } return null; }
protected function populateClassMapIndex(Project $project) { $classMap = $this->getComposerUtils()->getCanonicalClassMap($project->getRootDir()); $index = $project->getIndex(); $index->setClassMap($classMap); }