Passed
Pull Request — master (#2028)
by Gabriel
203:46 queued 138:41
created

ErrbitLoggerFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createErrbitHandler() 0 9 1
1
<?php
2
declare( strict_types=1 );
3
4
namespace WMDE\Fundraising\Frontend\Factories;
5
6
use Airbrake\MonologHandler as AirbrakeHandler;
7
use Airbrake\Notifier;
8
use Monolog\Handler\HandlerInterface;
9
use Monolog\Logger;
10
use Psr\Log\LogLevel;
11
12
class ErrbitLoggerFactory {
13
	public static function createErrbitHandler( string $projectId, string $projectKey, string $host, string $environment = 'dev', ?string $level = LogLevel::DEBUG, bool $bubble = true ): HandlerInterface {
14
		$notifier = new Notifier( [
15
			'projectId' => $projectId,
16
			'projectKey' => $projectKey,
17
			'host' => $host,
18
			'environment' => $environment
19
		] );
20
21
		return new AirbrakeHandler( $notifier, Logger::toMonologLevel( $level ?? LogLevel::DEBUG ), $bubble );
22
	}
23
24
}
25