Conditions | 4 |
Paths | 4 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
22 | 7 | public function seekForInconsistencies(Interval $interval): InconsistenciesResult |
|
23 | { |
||
24 | 7 | $result = new InconsistenciesResult(); |
|
25 | |||
26 | 7 | $expected = $this->queryExecutor->findAllReferencedByInterval( |
|
27 | 7 | $this->referencesConfiguration->getReferencedColumn(), |
|
28 | 7 | $interval |
|
29 | ); |
||
30 | |||
31 | 7 | $actual = $this->queryExecutor->aggregateReferencesByInterval( |
|
32 | 7 | $this->referencesConfiguration->getTableReferencesList(), |
|
33 | 7 | $interval |
|
34 | ); |
||
35 | |||
36 | 7 | foreach ($expected as $id => $number) { |
|
37 | 7 | if (!isset($actual[$id])) { |
|
38 | 2 | $result->addOrphanedRecordId($id); |
|
39 | 7 | } elseif ($actual[$id] !== $expected[$id]) { |
|
40 | 2 | $result->addInvalidReferenceCount($id, $actual[$id]); |
|
41 | } |
||
42 | |||
43 | 7 | unset($actual[$id]); |
|
44 | } |
||
45 | |||
46 | 7 | $result->setMissingReferenceCounts($actual); |
|
47 | |||
48 | 7 | return $result; |
|
49 | } |
||
50 | } |
||
51 |