We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 8 |
| Paths | 20 |
| Total Lines | 46 |
| Code Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function getMessages(): array |
||
| 31 | { |
||
| 32 | $resultIterator = new ResultIterator($this->result); |
||
| 33 | $recursiveResultIterator = new RecursiveIteratorIterator( |
||
| 34 | $resultIterator, |
||
| 35 | RecursiveIteratorIterator::SELF_FIRST |
||
| 36 | ); |
||
| 37 | |||
| 38 | $messages = []; |
||
| 39 | $current = []; |
||
| 40 | |||
| 41 | /* @var Result $childResult */ |
||
| 42 | $lastDepth = 0; |
||
| 43 | foreach ($recursiveResultIterator as $key => $childResult) { |
||
| 44 | $childMessage = $this->factory->message($childResult); |
||
| 45 | |||
| 46 | $currentDepth = $recursiveResultIterator->getDepth(); |
||
| 47 | if ($currentDepth < $lastDepth) { |
||
| 48 | if (count($current) === 1) { |
||
| 49 | $current = current($current); |
||
| 50 | } |
||
| 51 | unset($current); |
||
| 52 | $current = []; |
||
| 53 | } |
||
| 54 | |||
| 55 | if ($childMessage->isIgnorable() |
||
| 56 | && $recursiveResultIterator->callHasChildren()) { |
||
| 57 | $messages[$key] =& $current; |
||
| 58 | continue; |
||
| 59 | } |
||
| 60 | |||
| 61 | if ($currentDepth === 0) { |
||
| 62 | $messages[$key] = $childMessage->__toString(); |
||
| 63 | } else { |
||
| 64 | $current[$key] = $childMessage->__toString(); |
||
| 65 | } |
||
| 66 | |||
| 67 | $lastDepth = $currentDepth; |
||
| 68 | } |
||
| 69 | |||
| 70 | if (empty($messages)) { |
||
| 71 | $messages[] = $this->factory->message($this->result)->__toString(); |
||
| 72 | } |
||
| 73 | |||
| 74 | return $messages; |
||
| 75 | } |
||
| 76 | } |
||
| 77 |