Completed
Pull Request — master (#69)
by Freek
01:24
created

BaseFlareHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A shouldReport() 0 6 2
1
<?php
2
3
namespace Facade\Ignition\Logger;
4
5
use Facade\FlareClient\Flare;
6
use Monolog\Handler\AbstractProcessingHandler;
7
use Monolog\Logger;
8
use Throwable;
9
10
abstract class BaseFlareHandler extends AbstractProcessingHandler
11
{
12
    /** @var \Facade\FlareClient\Flare */
13
    protected $flare;
14
15
    public function __construct(Flare $flare, $level = Logger::DEBUG, $bubble = true)
16
    {
17
        $this->flare = $flare;
18
19
        parent::__construct($level, $bubble);
20
    }
21
22
    protected function shouldReport(array $report): bool
23
    {
24
        $context = $report['context'];
25
26
        return isset($context['exception']) && $context['exception'] instanceof Throwable;
27
    }
28
}
29
30