diff --git a/src/api/Hello/SayHello.php b/src/api/Hello/SayHello.php index 21fe4e4..04efd99 100644 --- a/src/api/Hello/SayHello.php +++ b/src/api/Hello/SayHello.php @@ -16,13 +16,9 @@ public function __invoke(ServerRequestInterface $request): ResponseInterface return Response::fromText("Hello {$request->getAttribute('name')}!"); } - /* - * Initial commit - */ public static function getRoute(): Route { return Route::get('/hello/{name}'); } - //pull test2 } diff --git a/src/api/Stilus.php b/src/api/Stilus.php index 2f48a85..a0c55fc 100644 --- a/src/api/Stilus.php +++ b/src/api/Stilus.php @@ -83,8 +83,8 @@ private function setupServer(array $config): Server $httpConfiguration->setLogFile(STILUS_DIR . DIRECTORY_SEPARATOR . $config['log_file']); } - define('STILUS_SERVER_ENABLED', true); - define('STILUS_SERVER_START', time()); + \define('STILUS_SERVER_ENABLED', true); + \define('STILUS_SERVER_START', time()); return new Server($httpConfiguration); } @@ -101,15 +101,17 @@ public function main(): void } $server = null; - if (isset($config['api']) && - isset($config['api']['http_server']) && - isset($config['api']['http_server']['enable']) && - $config['api']['http_server']['enable'] - ) { + if ($this->isServerEnable($config)) + { $server = $this->setupServer($config['api']['http_server']); } $application->run($server); } + private function isServerEnable(array $config): bool + { + return isset($config['api']['http_server']['enable']) && $config['api']['http_server']['enable']; + } + // Run application in contained scope })->main();