Skip to content

Commit b571f14

Browse files
committed
improved coding standards
1 parent eaa7c0b commit b571f14

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/HttpAuthExtension/HttpAuthExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Nette\PhpGenerator\ClassType;
1818

1919

20-
class HttpAuthExtension extends CompilerExtension
20+
final class HttpAuthExtension extends CompilerExtension
2121
{
2222

2323
public function __construct()
@@ -53,6 +53,7 @@ public function afterCompile(ClassType $class): void
5353
public static function register(Configurator $configurator, string $prefix = 'httpAuth'): void
5454
{
5555
$class = __CLASS__;
56+
5657
$configurator->onCompile[] = static function ($configurator, $compiler) use ($prefix, $class): void {
5758
$compiler->addExtension($prefix, new $class);
5859
};

src/HttpAuthExtension/HttpAuthenticator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Nette\Http\IResponse;
1616

1717

18-
class HttpAuthenticator
18+
final class HttpAuthenticator
1919
{
2020

2121
/** @var IResponse */
@@ -43,10 +43,10 @@ public function __construct(IResponse $response, string $username, string $passw
4343
public function run(): void
4444
{
4545
if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] !== $this->username || $_SERVER['PHP_AUTH_PW'] !== $this->password) {
46-
$this->response->setHeader('WWW-Authenticate', 'Basic realm="' . $this->title . '"');
46+
$this->response->setHeader('WWW-Authenticate', sprintf('Basic realm="%s"', $this->title));
4747
$this->response->setCode(IResponse::S401_UNAUTHORIZED);
4848
echo '<h1>Authentication failed.</h1>';
49-
die();
49+
exit(1);
5050
}
5151
}
5252

0 commit comments

Comments
 (0)