cleanup
parent
cacde1ea72
commit
e162d94e14
|
@ -107,10 +107,6 @@ abstract class AbstractAggregateIndex implements ReadableIndex
|
||||||
public function getDefinitions(): \Generator
|
public function getDefinitions(): \Generator
|
||||||
{
|
{
|
||||||
foreach ($this->getIndexes() as $index) {
|
foreach ($this->getIndexes() as $index) {
|
||||||
// foreach ($index->getDefinitions() as $fqn => $definition) {
|
|
||||||
// yield $fqn => $definition;
|
|
||||||
// }
|
|
||||||
|
|
||||||
yield from $index->getDefinitions();
|
yield from $index->getDefinitions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,10 +120,6 @@ abstract class AbstractAggregateIndex implements ReadableIndex
|
||||||
public function getDefinitionsForFqn(string $fqn): \Generator
|
public function getDefinitionsForFqn(string $fqn): \Generator
|
||||||
{
|
{
|
||||||
foreach ($this->getIndexes() as $index) {
|
foreach ($this->getIndexes() as $index) {
|
||||||
// foreach ($index->getDefinitionsForFqn($fqn) as $symbolFqn => $definition) {
|
|
||||||
// yield $symbolFqn => $definition;
|
|
||||||
// }
|
|
||||||
|
|
||||||
yield from $index->getDefinitionsForFqn($fqn);
|
yield from $index->getDefinitionsForFqn($fqn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,10 +149,6 @@ abstract class AbstractAggregateIndex implements ReadableIndex
|
||||||
public function getReferenceUris(string $fqn): \Generator
|
public function getReferenceUris(string $fqn): \Generator
|
||||||
{
|
{
|
||||||
foreach ($this->getIndexes() as $index) {
|
foreach ($this->getIndexes() as $index) {
|
||||||
// foreach ($index->getReferenceUris($fqn) as $uri) {
|
|
||||||
// yield $uri;
|
|
||||||
// }
|
|
||||||
|
|
||||||
yield from $index->getReferenceUris($fqn);
|
yield from $index->getReferenceUris($fqn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,12 +103,6 @@ class Index implements ReadableIndex, \Serializable
|
||||||
*/
|
*/
|
||||||
public function getDefinitions(): \Generator
|
public function getDefinitions(): \Generator
|
||||||
{
|
{
|
||||||
// foreach ($this->fqnDefinitions as $fqnDefinition) {
|
|
||||||
// foreach ($fqnDefinition as $fqn => $definition) {
|
|
||||||
// yield $fqn => $definition;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
yield from $this->yieldDefinitionsRecursively($this->definitions);
|
yield from $this->yieldDefinitionsRecursively($this->definitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,14 +114,10 @@ class Index implements ReadableIndex, \Serializable
|
||||||
*/
|
*/
|
||||||
public function getDefinitionsForFqn(string $fqn): \Generator
|
public function getDefinitionsForFqn(string $fqn): \Generator
|
||||||
{
|
{
|
||||||
// foreach ($this->fqnDefinitions[$fqn] ?? [] as $symbolFqn => $definition) {
|
|
||||||
// yield $symbolFqn => $definition;
|
|
||||||
// }
|
|
||||||
|
|
||||||
$parts = $this->splitFqn($fqn);
|
$parts = $this->splitFqn($fqn);
|
||||||
if ('' === end($parts)) {
|
if ('' === end($parts)) {
|
||||||
// we want to return all the definitions in the given FQN, not only
|
// 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);
|
array_pop($parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,19 +139,6 @@ class Index implements ReadableIndex, \Serializable
|
||||||
*/
|
*/
|
||||||
public function getDefinition(string $fqn, bool $globalFallback = false)
|
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);
|
$parts = $this->splitFqn($fqn);
|
||||||
$result = $this->getIndexValue($parts, $this->definitions);
|
$result = $this->getIndexValue($parts, $this->definitions);
|
||||||
|
|
||||||
|
@ -175,11 +152,6 @@ class Index implements ReadableIndex, \Serializable
|
||||||
|
|
||||||
return $this->getDefinition($fqn);
|
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)
|
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);
|
$parts = $this->splitFqn($fqn);
|
||||||
$this->indexDefinition(0, $parts, $this->definitions, $definition);
|
$this->indexDefinition(0, $parts, $this->definitions, $definition);
|
||||||
|
|
||||||
|
@ -213,17 +178,7 @@ class Index implements ReadableIndex, \Serializable
|
||||||
*/
|
*/
|
||||||
public function removeDefinition(string $fqn)
|
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);
|
$parts = $this->splitFqn($fqn);
|
||||||
|
|
||||||
$this->removeIndexedDefinition(0, $parts, $this->definitions);
|
$this->removeIndexedDefinition(0, $parts, $this->definitions);
|
||||||
|
|
||||||
unset($this->references[$fqn]);
|
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.
|
* Returns a Genrerator containing all the into the given $storage recursively.
|
||||||
* The generator yields key => value pairs, eg
|
* The generator yields key => value pairs, eg
|
||||||
|
|
Loading…
Reference in New Issue