Completed
Push — master ( 0cd2cd...e2ec22 )
by Sam
02:48
created

ServerTerminator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

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

26
    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...
27
    {
28
        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...
29
    }
30
}
31