Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit 4299d10

Browse files
committed
coding style: fixes in code
1 parent 35cc51d commit 4299d10

File tree

6 files changed

+18
-17
lines changed

6 files changed

+18
-17
lines changed

app/model/UserManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(Nette\Database\Context $database)
4040
*/
4141
public function authenticate(array $credentials): Nette\Security\IIdentity
4242
{
43-
list($username, $password) = $credentials;
43+
[$username, $password] = $credentials;
4444

4545
$row = $this->database->table(self::TABLE_NAME)->where(self::COLUMN_NAME, $username)->fetch();
4646

app/presenters/ErrorPresenter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function run(Nette\Application\Request $request): Nette\Application\IResp
3232

3333
if ($e instanceof Nette\Application\BadRequestException) {
3434
// $this->logger->log("HTTP code {$e->getCode()}: {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", 'access');
35-
list($module, , $sep) = Nette\Application\Helpers::splitName($request->getPresenterName());
35+
[$module, , $sep] = Nette\Application\Helpers::splitName($request->getPresenterName());
3636
return new Responses\ForwardResponse($request->setPresenterName($module . $sep . 'Error4xx'));
3737
}
3838

bin/create-user.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
exit(1);
1212
}
1313

14-
list(, $name, $email, $password) = $_SERVER['argv'];
14+
[, $name, $email, $password] = $_SERVER['argv'];
1515

1616
$container = require __DIR__ . '/../app/bootstrap.php';
1717
/** @var App\Model\UserManager $manager */

tests/ExampleTest.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ class ExampleTest extends Tester\TestCase
1616
private $container;
1717

1818

19-
function __construct(Nette\DI\Container $container)
19+
public function __construct(Nette\DI\Container $container)
2020
{
2121
$this->container = $container;
2222
}
2323

2424

25-
function setUp()
25+
public function setUp()
2626
{
2727
}
2828

2929

30-
function testSomething()
30+
public function testSomething()
3131
{
3232
Assert::true(true);
3333
}

www/adminer/index.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
declare(strict_types=1);
44

55
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !isset($_SERVER['REMOTE_ADDR']) ||
6-
!in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']))
7-
{
6+
!in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'], true)) {
87
header('HTTP/1.1 403 Forbidden');
98
echo 'Adminer is available only from localhost';
10-
for ($i = 2e3; $i; $i--) echo substr(" \t\r\n", rand(0, 3), 1);
9+
for ($i = 2e3; $i; $i--) {
10+
echo substr(" \t\r\n", rand(0, 3), 1);
11+
}
1112
exit;
1213
}
1314

www/checker/index.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88

99
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !isset($_SERVER['REMOTE_ADDR']) ||
10-
!in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']))
11-
{
10+
!in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'], true)) {
1211
header('HTTP/1.1 403 Forbidden');
1312
echo 'Requirements Checker is available only from localhost';
14-
for ($i = 2e3; $i; $i--) echo substr(" \t\r\n", rand(0, 3), 1);
13+
for ($i = 2e3; $i; $i--) {
14+
echo substr(" \t\r\n", rand(0, 3), 1);
15+
}
1516
exit;
1617
}
1718

@@ -290,8 +291,7 @@ function iniFlag($var)
290291
*/
291292
$errors = $warnings = false;
292293

293-
foreach ($tests as $id => $requirement)
294-
{
294+
foreach ($tests as $id => $requirement) {
295295
$tests[$id] = $requirement = (object) $requirement;
296296
if (isset($requirement->passed) && !$requirement->passed) {
297297
if ($requirement->required) {
@@ -488,12 +488,12 @@ function iniFlag($var)
488488
<?php foreach ($tests as $id => $requirement):?>
489489
<?php $class = isset($requirement->passed) ? ($requirement->passed ? 'passed' : ($requirement->required ? 'failed' : 'warning')) : 'info' ?>
490490
<tr id="res<?php echo $id ?>" class="<?php echo $class ?>">
491-
<th><?php echo htmlSpecialChars($requirement->title) ?></th>
491+
<th><?php echo htmlspecialchars($requirement->title) ?></th>
492492

493493
<?php if (empty($requirement->passed) && isset($requirement->errorMessage)): ?>
494-
<td><?php echo htmlSpecialChars($requirement->errorMessage) ?></td>
494+
<td><?php echo htmlspecialchars($requirement->errorMessage) ?></td>
495495
<?php elseif (isset($requirement->message)): ?>
496-
<td><?php echo htmlSpecialChars($requirement->message) ?></td>
496+
<td><?php echo htmlspecialchars($requirement->message) ?></td>
497497
<?php elseif (isset($requirement->passed)): ?>
498498
<td><?php echo $requirement->passed ? 'Enabled' : 'Disabled' ?></td>
499499
<?php else: ?>

0 commit comments

Comments
 (0)