| Conditions | 3 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3.0416 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 4 | public function filter(Collection $tickets): Collection |
|
| 29 | { |
||
| 30 | 4 | $configuration = $this->configuration; |
|
| 31 | |||
| 32 | 4 | $identifiers = $tickets->map(function (TicketCounter $ticketCounter) { |
|
| 33 | 4 | return $ticketCounter->getTicketType()->getIdentifier(); |
|
| 34 | 4 | }); |
|
| 35 | |||
| 36 | 4 | $p = function (TicketCounter $ticket) use ($configuration, $identifiers) { |
|
| 37 | 4 | $metadata = $configuration->getTicketMetadata($ticket->getTicketType()->getIdentifier()); |
|
| 38 | |||
| 39 | 4 | foreach ($metadata->getAfterSoldOut() as $identifier) { |
|
| 40 | if ($identifiers->contains($identifier)) { |
||
| 41 | return false; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | 4 | return true; |
|
| 46 | 4 | }; |
|
| 47 | return $tickets->filter($p); |
||
| 48 | } |
||
| 49 | } |