OnStartupHandler::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
ccs 0
cts 5
cp 0
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
crap 6
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\NewRelic\Loggers;
25
26
/**
27
 * On application startuo event
28
 *
29
 * @package        iPublikuj:NewRelic!
30
 * @subpackage     Events
31
 *
32
 * @author         Adam Kadlec <[email protected]>
33
 */
34 1
final class OnStartupHandler
35
{
36
	/**
37
	 * Implement nette smart magic
38
	 */
39 1
	use Nette\SmartObject;
40
41
	/**
42
	 * @param Application\Application $application
43
	 */
44
	public function __invoke(Application\Application $application) : void
45
	{
46
		// Check if new relict extension is loaded
47
		if (!extension_loaded('newrelic')) {
48
			return;
49
		}
50
51
		// Register new relic logger into tracy
52
		$logger = new Loggers\Logger(Debugger::$logDirectory, Debugger::$email);
53
54
		Debugger::setLogger($logger);
55
	}
56
}
57