Passed
Push — master ( cd5a13...405a7b )
by Adam
01:51
created

OnStartupHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 28.57%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 23
ccs 2
cts 7
cp 0.2857
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 12 2
1
<?php
2
/**
3
 * OnStartupHandler.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        https://www.ipublikuj.eu
7
 * @author         Adam Kadlec <[email protected]>
8
 * @package        iPublikuj:NewRelic!
9
 * @subpackage     Events
10
 * @since          1.0.0
11
 *
12
 * @date           25.05.15
13
 */
14
15
declare(strict_types = 1);
16
17
namespace IPub\NewRelic\Events;
18
19
use Nette;
20
use Nette\Application;
21
22
use Tracy\Debugger;
23
24
use IPub;
25
use IPub\NewRelic\Loggers;
26
27
/**
28
 * On application startuo event
29
 *
30
 * @package        iPublikuj:NewRelic!
31
 * @subpackage     Events
32
 *
33
 * @author         Adam Kadlec <[email protected]>
34
 */
35 1
final class OnStartupHandler
36
{
37
	/**
38
	 * Implement nette smart magic
39
	 */
40 1
	use Nette\SmartObject;
41
42
	/**
43
	 * @param Application\Application $application
44
	 */
45
	public function __invoke(Application\Application $application) : void
46
	{
47
		// Check if new relict extension is loaded
48
		if (!extension_loaded('newrelic')) {
49
			return;
50
		}
51
52
		// Register new relic logger into tracy
53
		$logger = new Loggers\Logger(Debugger::$logDirectory, Debugger::$email);
54
55
		Debugger::setLogger($logger);
56
	}
57
}
58