Total Complexity | 12 |
Total Lines | 65 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
13 | class NodeHashTable implements \IteratorAggregate, NodeCollectionInterface |
||
14 | { |
||
15 | /** @var Node<TState>[] */ |
||
16 | private array $nodes = []; |
||
17 | |||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | * @return \ArrayIterator<array-key, Node<TState>> |
||
21 | */ |
||
22 | 7 | public function getIterator(): \Traversable |
|
25 | } |
||
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | 13 | public function extractBest(): ?Node |
|
31 | { |
||
32 | 13 | $bestNode = null; |
|
33 | |||
34 | 13 | foreach ($this->nodes as $node) { |
|
35 | 13 | if ($bestNode === null || $node->getF() < $bestNode->getF()) { |
|
|
|||
36 | 13 | $bestNode = $node; |
|
37 | } |
||
38 | } |
||
39 | |||
40 | 13 | if ($bestNode !== null) { |
|
41 | 13 | $this->remove($bestNode); |
|
42 | } |
||
43 | |||
44 | 13 | return $bestNode; |
|
45 | } |
||
46 | |||
47 | 10 | public function get(string $nodeId): ?Node |
|
48 | { |
||
49 | 10 | return $this->nodes[$nodeId] ?? null; |
|
50 | } |
||
51 | |||
52 | 20 | public function add(Node $node): void |
|
53 | { |
||
54 | 20 | $this->nodes[$node->getId()] = $node; |
|
55 | 20 | } |
|
56 | |||
57 | 14 | public function remove(Node $node): void |
|
60 | 14 | } |
|
61 | |||
62 | 13 | public function isEmpty(): bool |
|
63 | { |
||
64 | 13 | return empty($this->nodes); |
|
65 | } |
||
66 | |||
67 | 10 | public function contains(Node $node): bool |
|
68 | { |
||
69 | 10 | return isset($this->nodes[$node->getId()]); |
|
70 | } |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 13 | public function clear(): void |
|
78 | 13 | } |
|
79 | } |
||
80 |
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.