NullErrorHandler::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 1
nc 1
nop 2
1
<?php
2
3
namespace Nofw\Error;
4
5
/**
6
 * This handler can be used to avoid conditional calls.
7
 *
8
 * Error monitoring should always be optional, and if no handler is provided to your
9
 * library creating a NullHandler instance to have something to throw logs at
10
 * is a good way to avoid littering your code with `if ($this->errorHandler) { }`
11
 * blocks.
12
 *
13
 * @author Márk Sági-Kazár <[email protected]>
14
 */
15
final class NullErrorHandler implements ErrorHandler
16
{
17
    public function handle(\Throwable $t, array $context = []): void
18
    {
19
        // noop
20
    }
21
}
22