| Total Complexity | 12 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class NodeHashTable implements \IteratorAggregate, NodeCollectionInterface |
||
| 8 | { |
||
| 9 | /** @var Node[] */ |
||
| 10 | private array $nodes = []; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * {@inheritdoc} |
||
| 14 | */ |
||
| 15 | 7 | public function getIterator(): iterable |
|
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * {@inheritdoc} |
||
| 22 | */ |
||
| 23 | 13 | public function extractBest(): ?Node |
|
| 24 | { |
||
| 25 | 13 | $bestNode = null; |
|
| 26 | |||
| 27 | 13 | foreach ($this->nodes as $node) { |
|
| 28 | 13 | if ($bestNode === null || $node->getF() < $bestNode->getF()) { |
|
|
|
|||
| 29 | 13 | $bestNode = $node; |
|
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | 13 | if ($bestNode !== null) { |
|
| 34 | 13 | $this->remove($bestNode); |
|
| 35 | } |
||
| 36 | |||
| 37 | 13 | return $bestNode; |
|
| 38 | } |
||
| 39 | |||
| 40 | 10 | public function get(string $nodeId): ?Node |
|
| 41 | { |
||
| 42 | 10 | return $this->nodes[$nodeId] ?? null; |
|
| 43 | } |
||
| 44 | |||
| 45 | 20 | public function add(Node $node): void |
|
| 46 | { |
||
| 47 | 20 | $this->nodes[$node->getId()] = $node; |
|
| 48 | 20 | } |
|
| 49 | |||
| 50 | 14 | public function remove(Node $node): void |
|
| 53 | 14 | } |
|
| 54 | |||
| 55 | 13 | public function isEmpty(): bool |
|
| 56 | { |
||
| 57 | 13 | return empty($this->nodes); |
|
| 58 | } |
||
| 59 | |||
| 60 | 10 | public function contains(Node $node): bool |
|
| 61 | { |
||
| 62 | 10 | return isset($this->nodes[$node->getId()]); |
|
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * {@inheritdoc} |
||
| 67 | */ |
||
| 68 | 13 | public function clear(): void |
|
| 71 | 13 | } |
|
| 72 | } |
||
| 73 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.