Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/api/Hello/SayHello.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
16 changes: 9 additions & 7 deletions src/api/Stilus.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bluebat-pl Please import function to current namespace.

\define('STILUS_SERVER_START', time());

return new Server($httpConfiguration);
}
Expand All @@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bluebat-pl If you need it to be more expressive please use variable: $isServerEnabled = .... instead method call.

{
$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();