1
0
Fork 0
pull/451/head
Nicolas MURE 2017-11-14 13:44:23 +01:00
parent cacde1ea72
commit e162d94e14
No known key found for this signature in database
GPG Key ID: E5B036F9145C4CAA
2 changed files with 1 additions and 73 deletions

View File

@ -107,10 +107,6 @@ abstract class AbstractAggregateIndex implements ReadableIndex
public function getDefinitions(): \Generator
{
foreach ($this->getIndexes() as $index) {
// foreach ($index->getDefinitions() as $fqn => $definition) {
// yield $fqn => $definition;
// }
yield from $index->getDefinitions();
}
}
@ -124,10 +120,6 @@ abstract class AbstractAggregateIndex implements ReadableIndex
public function getDefinitionsForFqn(string $fqn): \Generator
{
foreach ($this->getIndexes() as $index) {
// foreach ($index->getDefinitionsForFqn($fqn) as $symbolFqn => $definition) {
// yield $symbolFqn => $definition;
// }
yield from $index->getDefinitionsForFqn($fqn);
}
}
@ -157,10 +149,6 @@ abstract class AbstractAggregateIndex implements ReadableIndex
public function getReferenceUris(string $fqn): \Generator
{
foreach ($this->getIndexes() as $index) {
// foreach ($index->getReferenceUris($fqn) as $uri) {
// yield $uri;
// }
yield from $index->getReferenceUris($fqn);
}
}

View File

@ -103,12 +103,6 @@ class Index implements ReadableIndex, \Serializable
*/
public function getDefinitions(): \Generator
{
// foreach ($this->fqnDefinitions as $fqnDefinition) {
// foreach ($fqnDefinition as $fqn => $definition) {
// yield $fqn => $definition;
// }
// }
yield from $this->yieldDefinitionsRecursively($this->definitions);
}
@ -120,14 +114,10 @@ class Index implements ReadableIndex, \Serializable
*/
public function getDefinitionsForFqn(string $fqn): \Generator
{
// foreach ($this->fqnDefinitions[$fqn] ?? [] as $symbolFqn => $definition) {
// yield $symbolFqn => $definition;
// }
$parts = $this->splitFqn($fqn);
if ('' === end($parts)) {
// we want to return all the definitions in the given FQN, not only
// the one matching exactly the FQN.
// the one (non member) matching exactly the FQN.
array_pop($parts);
}
@ -149,19 +139,6 @@ class Index implements ReadableIndex, \Serializable
*/
public function getDefinition(string $fqn, bool $globalFallback = false)
{
// $namespacedFqn = $this->extractNamespacedFqn($fqn);
// $definitions = $this->fqnDefinitions[$namespacedFqn] ?? [];
// if (isset($definitions[$fqn])) {
// return $definitions[$fqn];
// }
// if ($globalFallback) {
// $parts = explode('\\', $fqn);
// $fqn = end($parts);
// return $this->getDefinition($fqn);
// }
$parts = $this->splitFqn($fqn);
$result = $this->getIndexValue($parts, $this->definitions);
@ -175,11 +152,6 @@ class Index implements ReadableIndex, \Serializable
return $this->getDefinition($fqn);
}
// return $result instanceof Definition
// ? $result
// : null
// ;
}
/**
@ -191,13 +163,6 @@ class Index implements ReadableIndex, \Serializable
*/
public function setDefinition(string $fqn, Definition $definition)
{
// $namespacedFqn = $this->extractNamespacedFqn($fqn);
// if (!isset($this->fqnDefinitions[$namespacedFqn])) {
// $this->fqnDefinitions[$namespacedFqn] = [];
// }
// $this->fqnDefinitions[$namespacedFqn][$fqn] = $definition;
$parts = $this->splitFqn($fqn);
$this->indexDefinition(0, $parts, $this->definitions, $definition);
@ -213,17 +178,7 @@ class Index implements ReadableIndex, \Serializable
*/
public function removeDefinition(string $fqn)
{
// $namespacedFqn = $this->extractNamespacedFqn($fqn);
// if (isset($this->fqnDefinitions[$namespacedFqn])) {
// unset($this->fqnDefinitions[$namespacedFqn][$fqn]);
// if (empty($this->fqnDefinitions[$namespacedFqn])) {
// unset($this->fqnDefinitions[$namespacedFqn]);
// }
// }
$parts = $this->splitFqn($fqn);
$this->removeIndexedDefinition(0, $parts, $this->definitions);
unset($this->references[$fqn]);
@ -324,21 +279,6 @@ class Index implements ReadableIndex, \Serializable
]);
}
/**
* @param string $fqn The symbol FQN
* @return string The namespaced FQN extracted from the given symbol FQN
*/
// private function extractNamespacedFqn(string $fqn): string
// {
// foreach (['::', '->'] as $operator) {
// if (false !== ($pos = strpos($fqn, $operator))) {
// return substr($fqn, 0, $pos);
// }
// }
// return $fqn;
// }
/**
* Returns a Genrerator containing all the into the given $storage recursively.
* The generator yields key => value pairs, eg