beyondcode /
laravel-mailbox
| 1 | <?php |
||
| 2 | |||
| 3 | namespace BeyondCode\Mailbox\Routing; |
||
| 4 | |||
| 5 | use BeyondCode\Mailbox\InboundEmail; |
||
| 6 | use Illuminate\Support\Collection; |
||
| 7 | |||
| 8 | class RouteCollection |
||
| 9 | { |
||
| 10 | protected $routes = []; |
||
| 11 | |||
| 12 | public function add(Route $route) |
||
| 13 | { |
||
| 14 | $this->routes[] = $route; |
||
| 15 | } |
||
| 16 | |||
| 17 | public function match(InboundEmail $message): Collection |
||
| 18 | { |
||
| 19 | return Collection::make($this->routes)->filter(function ($route) use ($message) { |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 20 | return $route->matches($message); |
||
| 21 | }); |
||
| 22 | } |
||
| 23 | } |
||
| 24 |