| Conditions | 5 |
| Paths | 6 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | 40 | protected function matchForVariable(string $variable, stdClass $data): bool |
|
| 41 | { |
||
| 42 | 40 | $variableExistInCitationItem = false; |
|
| 43 | 40 | if ($this->mode->equals(RenderingMode::CITATION()) && isset($data->id)) { |
|
| 44 | 8 | $id = $data->id; |
|
| 45 | $citationItem = $this->citationItems->filter(function ($item) use ($id) { |
||
| 46 | 3 | return $item->id === $id; |
|
| 47 | 8 | })->current(); |
|
| 48 | 8 | if (!empty($citationItem)) { |
|
| 49 | 3 | $variableExistInCitationItem = !empty($citationItem->{$variable}); |
|
| 50 | } |
||
| 51 | } |
||
| 52 | 40 | return !empty($data->{$variable}) || $variableExistInCitationItem; |
|
| 53 | } |
||
| 55 |