OnStartupHandler   A
last analyzed

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\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