CallableShutdownHandler::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
/**
4
 * This file is part of coisa/error-handler.
5
 *
6
 * (c) Felipe Sayão Lobato Abreu <[email protected]>
7
 *
8
 * This source file is subject to the license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
declare(strict_types=1);
13
14
namespace CoiSA\ErrorHandler\Handler;
15
16
/**
17
 * Class CallableShutdownHandler
18
 *
19
 * @package CoiSA\ErrorHandler\Handler
20
 */
21
final class CallableShutdownHandler implements ShutdownHandlerInterface
22
{
23
    /**
24
     * @var callable
25
     */
26
    private $handler;
27
28
    /**
29
     * CallableShutdownHandler constructor.
30
     *
31
     * @param callable $handler
32
     */
33 1
    public function __construct(callable $handler)
34
    {
35 1
        $this->handler = $handler;
36 1
    }
37
38
    /**
39
     * {@inheritDoc}
40
     */
41 1
    public function handleShutdown(): void
42
    {
43 1
        ($this->handler)();
44
    }
45
}
46