Skip to content

Commit

Permalink
fixing lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ridz1208 committed Dec 2, 2024
1 parent 156b19e commit 6296b4f
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions modules/biobank/php/endpoint.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ abstract class Endpoint
*
* @return array The data to be returned as JSON
*/
protected function get(QueryParams $params): array
{
return [];
}
abstract protected function get(QueryParams $params): array;

/**
* Defines the allowed HTTP methods for this endpoint.
Expand Down Expand Up @@ -101,21 +98,21 @@ abstract class Endpoint
$path = trim($request->getURI()->getPath(), "/");
$pathparts = explode('/', $path);

// Determine subendpoint handler based on the subpath
if (count($pathparts) > 1) {
// Check if sub-handlers are supported
// TODO: This can later be replaced with a check for the subhandler interface
// implementation rather than just checking if the function exists.
if (method_exists($this, 'getSubHandler') && count($pathparts) > 1) {
$subpath = $pathparts[1];
$subhandler = $this->getSubHandler($subpath);

if ($subhandler !== null) {
// Remove the handled part of the path and pass the remainder
$remainingPath = implode('/', array_slice($pathparts, 1));
// Remove the handled part of the path and pass the remainder
$remainingPath = implode('/', array_slice($pathparts, 1));

// Update the request URI path
$uri = $request->getUri()->withPath($remainingPath);
$request = $request->withUri($uri);
// Update the request URI path
$uri = $request->getUri()->withPath($remainingPath);
$request = $request->withUri($uri);

return $subhandler->process($request, $subhandler);
}
return $subhandler->process($request, $subhandler);
}

// Default processing for the main endpoint if no subendpoint matches
Expand Down Expand Up @@ -157,9 +154,6 @@ abstract class Endpoint
): ResponseInterface {
$this->checkPermission($request->getAttribute('user'), Permission::GET);

$path = trim($request->getURI()->getPath(), "/");
$pathparts = explode('/', $path);

$queryParams = (new QueryParamsHandler(
$request->getQueryParams()
))->parse();
Expand Down

0 comments on commit 6296b4f

Please sign in to comment.