Skip to content

Commit 5b2f465

Browse files
committed
php8-migration - extracted method for context
1 parent 56d664d commit 5b2f465

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/FF/Application.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,30 @@ public function __construct(ContainerInterface $container, array $config = [])
4444
*/
4545
public function run(): int
4646
{
47-
$context = [
48-
'request' => $this->request->server('REQUEST_URI'),
49-
'ip' => $this->request->server('REMOTE_ADDR')
50-
];
51-
5247
try {
5348
$this->registerController();
5449
$action = $this->router->getAction();
5550

5651
return $this->status ? $this->controller->$action() : $this->status;
5752
} catch (UnavailableRequestException $e) {
58-
$this->logger->error('Not available request', $context);
53+
$this->logger->error('Not available request', $this->getContext());
5954
$this->showErrorPage($e, '404 Page not found');
6055
exit();
6156
} catch (Exception $e) {
62-
$this->logger->error($e->getMessage(), $context);
57+
$this->logger->error($e->getMessage(), $this->getContext());
6358
$this->showErrorPage($e);
6459
exit();
6560
}
6661
}
6762

63+
private function getContext(): array
64+
{
65+
return [
66+
'request' => $this->request->server('REQUEST_URI'),
67+
'ip' => $this->request->server('REMOTE_ADDR')
68+
];
69+
}
70+
6871
/**
6972
* @param Exception $e
7073
* @param string $additionalInfo

0 commit comments

Comments
 (0)