ServerTerminator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 12
ccs 0
cts 4
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 4 1
A onException() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of PHP DNS Server.
5
 *
6
 * (c) Yif Swery <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace yswery\DNS\Event\Subscriber;
13
14
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15
use yswery\DNS\Event\Events;
16
use yswery\DNS\Event\ServerExceptionEvent;
17
18
class ServerTerminator implements EventSubscriberInterface
19
{
20
    public static function getSubscribedEvents(): array
21
    {
22
        return [
23
            Events::SERVER_START_FAIL => 'onException',
24
        ];
25
    }
26
27
    public function onException(ServerExceptionEvent $event): void
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

27
    public function onException(/** @scrutinizer ignore-unused */ ServerExceptionEvent $event): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
    {
29
        exit(1);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
30
    }
31
}
32