Skip to content

Commit

Permalink
TracyExtension: improved generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 11, 2019
1 parent 6a3dc0e commit 0a2f7c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Bridges/Nette/TracyExtension.php
Expand Up @@ -98,8 +98,7 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class)
$initialize->addBody($builder->formatPhp('Tracy\Debugger::setLogger(?);', [$logger]));
}
if ($this->config['netteMailer'] && $builder->getByType(Nette\Mail\IMailer::class)) {
$initialize->addBody($builder->formatPhp('Tracy\Debugger::getLogger(?)->mailer = ?;', [
$logger,
$initialize->addBody($builder->formatPhp('Tracy\Debugger::getLogger()->mailer = ?;', [
[new Nette\DI\Statement(Tracy\Bridges\Nette\MailSender::class, ['fromEmail' => $this->config['fromEmail']]), 'send'],
]));
}
Expand All @@ -117,8 +116,9 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class)
));
}

if (!$this->cliMode) {
$initialize->addBody('if ($tmp = $this->getByType("Nette\Http\Session", false)) { $tmp->start(); Tracy\Debugger::dispatch(); };');
if (!$this->cliMode && ($name = $builder->getByType(Nette\Http\Session::class))) {
$initialize->addBody('$this->getService(?)->isStarted() || $this->getService(?)->start();', [$name, $name]);
$initialize->addBody('Tracy\Debugger::dispatch();');
}
}

Expand Down

0 comments on commit 0a2f7c2

Please sign in to comment.