Conditions | 7 |
Paths | 8 |
Total Lines | 27 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 7.0796 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | 9 | public function skipClass(ClassMetadataInterface $class, ContextInterface $context) |
|
39 | { |
||
40 | 9 | $references = []; |
|
41 | 9 | $dataStack = $context->getDataStack(); |
|
42 | |||
43 | 9 | foreach ($context->getMetadataStack() as $depth => $metadata) { |
|
44 | 9 | $data = $dataStack[$depth]; |
|
45 | |||
46 | 9 | if (!$metadata instanceof ClassMetadataInterface || !is_object($data)) { |
|
47 | continue; |
||
48 | } |
||
49 | |||
50 | 9 | $hash = spl_object_hash($data); |
|
51 | |||
52 | 9 | if (!isset($references[$hash])) { |
|
53 | 9 | $references[$hash] = 0; |
|
54 | 6 | } |
|
55 | |||
56 | 9 | foreach ($references as &$reference) { |
|
57 | 9 | if (++$reference >= $this->limit) { |
|
58 | 9 | return true; |
|
59 | } |
||
60 | } |
||
61 | 6 | } |
|
62 | |||
63 | 9 | return false; |
|
64 | } |
||
65 | } |
||
66 |