| Total Complexity | 6 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class InitializeKernel |
||
| 14 | { |
||
| 15 | private $kernel; |
||
| 16 | private $channelManager; |
||
| 17 | |||
| 18 | public function __construct(FondBot $kernel, ChannelManager $channelManager) |
||
| 22 | } |
||
| 23 | |||
| 24 | public function handle(Request $request, Closure $next) |
||
| 25 | { |
||
| 26 | $channel = $this->resolveChannel($request->route('channel')); |
||
| 27 | |||
| 28 | if ($channel->getSecret() !== null && $request->route('secret') !== $channel->getSecret()) { |
||
| 29 | abort(403); |
||
| 30 | } |
||
| 31 | |||
| 32 | $this->kernel->initialize($channel); |
||
| 33 | |||
| 34 | return $next($request); |
||
| 35 | } |
||
| 36 | |||
| 37 | private function resolveChannel($value): Channel |
||
| 44 | } |
||
| 45 | } |
||
| 46 |